Which episode shows Naruto competing in a race to a shrine on the top of a hill? I only remember that Naruto was competing in some kind of competition (it's not an eating contest). From the start line, they have to get to a shrine, where some kind of prize has been placed, on the very top of a hill.

I think it was from Naruto.
You're referring to Idate's Arc in Land of Tea Escort Mission from Episode 102-106.

As per Wikia: Source: http://naruto.wikia.com/wiki/Land_of_Tea_Escort_Mission


  The Land of Tea Escort Mission spans from episodes 102 to 106 of the Naruto anime. Naruto, Sasuke, and Sakura go to the Land of Tea to help Idate Morino win a race. This arc is preceded by the Search for Tsunade and is followed by the Sasuke Recovery Mission.


This arc is Anime only (i.e. Filler). While filler arcs are usually not upto par with the main storyline, this was a watchable arc as it showcased the Naruto/Sasuke dynamic really well while setting up the next and best arc of the series.