To stop the flow of fuel, you would need to disconnect the fuel pump's electrical connection or the fuel pump relay. This requires mechanical expertise and is not recommended unless you are experienced with car mechanics and are comfortable working with the fuel system (which is dangerous due to the flammability of fuel). Improperly disconnecting these components can damage your vehicle and create a safety hazard.
In a true emergency, the safest and most effective way to stop a fuel-related fire is to utilize a fire extinguisher or call emergency services.