Starts but cuts off

i have an 87 toyota 4runner with the 22re last week the starter stuck on and drained the battery and burned the starter up so i replaced the battery and starter and now it will start and run for about 3 seconds and run out of gas

Check to see if there are any codes stored in the ECU for clues to the trouble. It sounds like the ECU may be shutting the fuel pump circuit down. It is a safety feature that usually is activated when the ECU doesn’t sense ignition pulses while the pump is running. Also make sure all the fuses are okay.

checked the codes and it says everything is normal and all the fuses are good

There are no codes for fuel pump and few codes for the rest of the fueling system. Start with fuel pressure and go from there.

Along with checking the fuel pressure you could check the voltage getting to the fuel pump. See if it is being cut off just before the engine dies.

Replacing the starter on some cars requires removing the air cleaner and a bunch of other stuff. If the car ran fine before, and all you did was replace the starter, I expect it hasn’t been put back together correctly. It may not be the gas, it might be something is blocking the airflow to the engine for example Or an important sensor wire remains disconnected or connected to the wrong gadget. Or a vacuum hose hasn’t been reconnected.