i had a ford gasser that done that and i finally blew air back through the line to the tank and with a big thunk the pick up filter blew off. after draining out a quart of water it ran fine. i punched a hole in the tank with a sharp nail and screwed a roofing screw with a rubber washer in and it ran another 60,000mi with out a hiccup.
another similar on a company generator with a john deer diesel engine. same symptoms. finally got a service tech out and he immediately tracked it down to the fuel pick up with a vacuum gauge.