When you turn off the ignition and the engine sputters on, it’s called dieseling. High-octane gas may help; if not, look for a mechanical fault.
Check the engine idle speed, for which you’ll need a tachometer. If the idle speed is too high, a carburetor adjustment may cure dieseling. If the carburetor has a solenoid, its plunger may not be retracting when you turn off the ignition (have a helper look). If it is not retracting, replace the solenoid.
The idle may be too high because the throttle linkage is sticking. With the engine running, push the linkage. If the idle drops, the linkage apparently is sticking. Spray it with aerosol solvent to remove dirt.