There is a very simple test for this:
Engage the PTO. If the engine dies, there is a problem with the seat switch.
If the engine only dies when depressing the HST pedal, the problem is with the HST safety switch. Usually, it is the switch that needs adjustment.