Troubleshooting an erratic low fuel light is pretty simple. A faulty fuel level sensor is usually the problem but an intermittent short circuit in the wiring or connectors could also be the problem.
The electrical circuit is a simple one. The fuel level warning light becomes lit when the fuel level sensor (switch) closes the circuit allowing current to flow through the sensor to the light and then to ground to complete the circuit.
So, a problem in the wiring or connectors will bypass the sensor (short circuit.)
But, since erratic behavior of the fuel level sensor is quite common it should be the first suspect. Ducati has tried a number of different sensor and connector designs and changed vendor sources over the years in an attempt to improve reliability. Consequently, if you have to replace a fuel level sensor on an early year bike, it's probably best to replace it with a unit made for a later year even though this will sometimes require changing the connector type.
A faulty sensor will continuously, or intermittently, stick open or closed.
If the light stays on, either the sensor switch is stuck closed, or there is a short circuit that has bypassed the sensor.
So for example, the warning light may come on prematurely due to fuel sloshing, and stay on due to a sticking sensor even though there is an adequate fuel reserve in the tank. Or, an intermittent short circuit will cause the same behavior.
Similarly, the warning light may extinguish due to fuel sloshing, and stay off due to a sticking sensor even though there is a low fuel reserve. Or, an intermittent open circuit will cause the same behavior. Or the indicator lamp is burned out.
But the only way to be sure is to use your service manual and a multimeter and check it out yourself or take it to your dealer.
First, disconnect the wire harness under the tank. The two smaller wires are the low-fuel dash light signal. Short them together and if the light comes on, the sender is faulty.