As there is no spark in a diesel engine, the only thing that stops the engine is lack of fuel. This suggests that the fuel solenoid is not staying on. You should find that when the key turns to start, there is 12v on the solenoid and the engine starts. When you release the key the 12v should still be on the solenoid or the engine will stop. If the 12v is not present, then it is probable that the ignition switch is faulty as it should give 12 in both start and run positions. It can be bypassed by simply putting a wire from battery to solenoid. The problem that you then have is that you need to disconnect the wire to stop the engine, this may be a safety concern. It will however confirm where the problem lies.
Cityfarma