Yes, some marathon runners listen to music both during their training and the race itself. Most marathons allow race participants to use headphones in the race, as long as they aren’t competing for a prize.