Onan engines are notorious for surging, and there are several things that can cause it.
Make sure that the throttle linkage is free and unobstructed. Also that it is installed correctly.
Dirt in the carburetor air bleeds can give this problem. Also a missing welch plug at the front of the carburetor. Check that you can adjust the idle mixture. Should come in at about 1-3/4 turns open.
Air leaks under the carburetor are a common problem. The intake manifold is made in two pieces sealed by RTV. On an old engine, you'll need to reseal the manifold halves. Surging from air leaks is generally more pronounced under light load and reduced when you load the engine (mow grass).
Generally, with a "new to me" 318 or 420, it's wise to R&R the engine, remove all the shroud sheet metal and clean out accumulated dirt. Also, remove the flywheel and clean off the alternator coils and (on P-series) clean and inspect the ignition components. While you are at it, you can seal any oil leaks (crankshaft seals, oil filter mount) and make sure the crankcase-fuel pump hose is in good condition.