You may read the instant fuel consumption from the Data Bus, then accumulate it over time and/or subtract it from a given start value.
// Available fuel in grams (g): 10 Kg
float availableFuel = 10000.0f;
// Get instant fuel consumption rate in grams per second (g/s)
float instantFuelConsumption = vehicle.data.Get(Channel.Vehicle, VehicleData.EngineFuelRate) / 1000.0f;
// Account for the fuel consumed this frame
availableFuel -= instantFuelConsumption * Time.deltaTime;
// Ensure the engine can run only when fuel is available.
Engine engine = vehicle.GetInternalObject(typeof(Engine)) as Engine;
if (availableFuel > 0.0f)
engine.allowedFuelRatio = 1.0f;
else
engine.allowedFuelRatio = 0.0f;
Configuring the fuel consumption in the engine is documented in this answer:
https://support.vehiclephysics.com/80/how-to-simulate-fuel-consumption
Note: accessing the Engine block is not available in the Community Edition. Here GetInternalObject always return null.