This is an example of hyperbole. There is no metaphor; the person is saying "You are so far in front of everyone else that you could be racing on your head instead of on your feet and you would still win."
It is hyperbole because, of course, you cannot run a race with your head on the ground and your feet in the air. If you practice you might be able to balance in that position but you would not be able to move forward. You could run a race by walking on your hands instead of your feet, at least in theory, but you would get tired very quickly.
Personally I have never heard "on your head" used like this, but I have heard many other versions, where it is said that you could do some task or win some competition even if you were physically limited:
You could do this thing...
...in your sleep.
...blindfolded.
...with one hand tied behind your back.
...with two hands tied behind your back.
...sitting down.
And other versions where it is said that the thing is so easy for you to do, you would not show any signs of physical exertion:
...without breaking a sweat.
...without getting out of breath.
These are all hyperbolic, in that they are not literally true statements (with the possible exception of "blindfolded" and "with one or both hands tied behind your back," depending on what the activity is).