On a gas engine idle surges are usually too lean fuel mixture. Sometimes as a quick fix you can access some air bleed jets located in the air stream at the top of the carb by removing the top of the carb and spraying the jets with carb cleaner. For emission reasons most engines have a crankcase vent hose directed into the carb top after the air filter. As the engine gets older and blow by increases this oily air leads to crud building up on the jets. Although contrary to good environmental practice, I remove this hose and run it to the ground. If I am feeling really guilty I put a filter on it to catch the oil and change the filter regularly.
Sometimes a thorough carb cleaning is necessary.
Dave M7040