I considered this a few years ago myself, and the answer is that it would be impossible for a number of reasons, all to do with the lack of air.
Without air, the engine would not be able to cool itself, and would overheat.
Also, from my memory of thermodynamics, heat engines require a temperature difference between two substances in order to work. I can't see what the lower temperature substance would be on the moon.
Thirdly, F1 engines need a source oxygen, which again is absent.
To make it work you'd need to either use battery-powered cars cooled by radiation only, or run the event in an artificial atmosphere.
If that happened, everything would be the same except the cars would have much less grip, and lower rolling resistance for any given tyre.