Your number one concern needs to be ensuring water never makes it to the engine else you will have much bigger issues. Identify where the water is coming from.
Having said that, this is a common/known issue, and one I am dealing with myself.
1. Iād suggest changing the filter in the racor and draining the whole thing 100% and starting fresh.
2. Change the on engine filter and dump that out to ensure 100% no water made it to that point.
3. Pull all the electrical connection plugs apart starting at the fuel bowl sensor and clean them with a tooth brush and WD-40 working your way back to the ECM.
4.You can change the sensor and that may fix the issue or it may come back.
https://www.sbmar.com/product/cummins-mercury-3970911-smartcraft-racor-wif-harness-sensor/
5. You can remove the sensor from the system by using the below terminating resistor where the WIF harness plugs into the engine harness and that will make the issue go away. HOWEVER, that means you will have NO wif detection and it is imperative your religious about ensuring NO water makes it into the engine.
https://www.sbmar.com/product/cummins-marine-water-fuel-wif-terminating-resistor/
6. If your running racors, consider upgrading to one of the SMX fuel filtration kits. Much better filtration, water removing capacity, easier to change, and less often service requirements.
https://www.sbmar.com/product-category/fuel-systems/fuel-filtration-kits/
Phil