I have had this issue a couple of times with my Kubota's. Turns out I let some bugs into the tank, most probably from the nozzle of the farm tank, that plugged the line from the tank to the fuel filter. The line is small enough to get plugged by a pretty small critter.
When the machine runs it will pull the obstruction into the line and then will release it when it shuts off. If it drifts far enough away it will run normally for awhile before it gets caught up again.
Next time the engine stumbles shut it down, disconnect the line from the filter and blow air back through it to the tank. If the problem clears this is the issue.
The ultimate fix is to drain the tank as much as possible and then try to clean out any debris you can see in the tank. Using a small diameter hose attached to a shop vac or a turkey baster should work. I also made a screen I inserted into the fuel tank fill to keep this from happening again. I think Bobcat/Kioti sells one that may fit your machine.