Converting a NEMA 6-50p plug to NEMA 10-30p
Your problem is where you source your ground. I updated the picture to show it better. The easy fix is if your wall has the ground wire but not connected. New dryer connections have 4 prongs to ensure you have ground protection as well as neutral.

Your current wall has only neutral on the 3rd prong. Neutral is meant to carry current and such if you touch it there is a potential hazard in case of a failure. Your compressor has ground PE on the 3rd prong, therefore connecting to the wall by just replacing the connector to match the wall would technically work, but it might not be safe.

The correct approach is to rewire your wall, by adding the ground PE which is probably just in there but not connected (bare copper wire). And then replace the compressor connector with one that connects only the two hot lines and the ground wire, as the compressor does not use the neutral.