In races, the wearing of headphones is mainly prohibited and you will be disqualified if seen. Organisers state in their entry procedures whether headphones are allowed.The rulebook says
UKA RULE 240 S 5 UKA SUPPLEMENT – HEADPHONES The wearing of headphones, or similar devices, (other than those medically prescribed), is not permitted in races on any single carriageway road that is not wholly closed to trafﬁc. This restriction does not apply to races held on dual carriageways provided that there are clear, structured separations between the separate carriageways. Competition Providers of races held entirely on roads closed to trafﬁc may apply this condition where appropriate to local circumstances.
240 S5 Use of headphones - Headphones that work by conducting sound through bones and do not sit in the ears are acceptable. Hearing is not affected as the ears are not blocked.