I think it was in the ’70s and I thought it was a Woody Allen comedy movie (but it isn’t Sleeper). I saw it on TV, so it may have been a TV show rather than a movie.
In the scene, a traveler (time traveler?) is walking with his friend, a local guide, on the beach at sunset. They join a group of people at the water’s edge, wailing that the sun (sun god) is leaving them and beseeching the sun to return. Further down the beach is a small crowd jeering the sun worshipers, hurling insults. The traveler asks is friend “who are those guys?”. The friend replies in disgust “Oh, it’s those damn Moon worshipers!”