There's two things to look for. If your engine has a distributor with an external ballast resistor, that resistor is usually bypassed by the ignition switch or a terminal on the starter solenoid, during cranking to overcome the normally-lower battery voltage and provide a stronger spark. Check if that ballast resistor is burned open. That was a common problem many years ago on some cars and the symptom was exactly what you described. An additional clue is the engine will stay running when you shift to "drive" and keep holding the ignition switch in the "crank" position. (You didn't say which engine you have or if it's an automatic transmission). When you shift to drive, if the engine stays running, that means the ballast resistor is being bypassed by the ignition switch. The starter will cut out thanks to the neutral safety switch so you can keep on holding the switch in the "crank" position. If the engine stalls when you shift to "drive", the resistor is bypassed by a tap on the starter solenoid.
The second possibility is a defective ignition switch or a problem in its wiring going to that ballast resistor. You can determine that by measuring the voltage at the positive terminal of the ignition coil. There should be 12 volts there with the ignition switch in the "run" position.