Hmmm. It's probably even worse having it directly above the batteries given the outgassing of hydrogen gas! You'd be MUCH better off doing like the factory would have done and connect the charger via a hardline to an unused 120V breaker (or adding one).Well I just added a receptacle in my engine room up on the side near the batteries for a dedicated charger / maintainer then came in to see whats new on Clubsearay and read this disheartening post. LOL
You don't want to mess around with this - these are the sort of accidents that we read about in the newspapers when things get installed wrongly without doing the research, first. At least you caught it early.
Did you buy a charger that is rated for gasoline bilge use?