Water in the line seems unlikely to me, but it’s an easy problem to fix - just pour a bottle of rubbing alcohol into a full tank of gas. The alcohol will allow the water to mix with the gas and flow through the system.
A little water in the gas line causes fuel starvation. The engine uses the least amount of fuel at idle, so if there’s enough water to make it idle rough, I would expect it to have no power at all (i.e. you might not be able to even drive the truck). What’s more, the check engine light has been on for a month prior to the rough idle and lack of power.
Modern cars and trucks have lots of sensors (transponders) monitored by a computer. When the computer detects that one or more signals from the sensors isn’t what it should be, the check engine light comes on. The mechanic has a diagnostic device he can plug into the car which reads a set code from the computer telling which sensor is acting up. Often this leads directly to a part that should be replaced, like the Exhaust Gas Recirculation valve (EGR valve).
Take the truck back to the dealer. Now that it’s acting up, it should be easier to diagnose the problem. If the dealer can’t fix it now, he’s not trying. In that case, take it to a competent mechanic who wants your business.