Surging while idling

The engine on my 2002 ford focus surges while in idle. It is rather rythmic and only occurs while in drive with the AC on. The surging get’s worse when it’s on max. Yet it doesn’t happen in park or with the AC off. What could be causing this?

There may be a vacuum leak. Check all hoses and clamps at the intake too.

Faulty fuel pump.

IAC (Idle Air Control) system faulty or perhaps an emissions problem.