No, you cannot wear headphones during any parts of the race. The International Triathlon Union (ITU) states:
“Athletes may not use communication devices of any type, including but not limited to cell phones, smart watches, and twoway radios, in any distractive manner during the competition. A “distractive manner” includes but is not limited to making and receiving phone calls, sending and receiving text messages, playing music, using social media, and taking photographs. Using a communication device in a distractive manner during the competition will result in disqualification;
Cameras, phone cameras, and video cameras are prohibited unless permission is given by the ITU or the license holder of the event. If such permission is given, it is the athlete’s responsibility to notify the Head Referee of such permission prior to the start of the competition. Athletes seen with an unauthorized camera, phone camera, or video camera will be disqualified.