Why does the oil pressure light come on when the engine idles but turn off the instant you hit the gas?

oil pressure is created by the oil pump, which is driven mechanically as the engine turns, and the faster it revs the harder it pumps. It should deliver enough pressure at idle for the light to stay off. Your problem is either a worn oil pump or your oil is too thin and needs changing. If you have an old engine, put in a heavier oil. Penrite 50 is good. Hi another possibility is your idle is set too low Also, you could have a bad or weak pressure release valve in your oil pump. (AKA bypass valve). In addition, if the oil has not been changed in a long time the oil filter may be filled with sludge reducing the pressure. Changing the oil and filter first to heavier oil is a good first step.

Your engine bearings may be worn and letting too much oil escape, resulting in low pressure when the oil pump is running slower (when the engine is running at idle). Revving the engine too high can cause damage to the rod bearings and allow oil to escape too easily. If your engine has a lot of miles on it, or if it has been run without changing the oil regularly, your engine will have a lot of wear. The oil pump, main bearings, rod bearings, and camshaft bearings may all have a lot of wear on them allowing the oil to easily escape without allowing pressure to build up. Rebuilding your engine may be needed. But try changing the oil pump first.