than if it was running on diesel and NOT charging batteries?

I'm thinking of an analogy to hybrid cars.
it is moving and charging at the same time

Most diesel subs run totally off of electric power. The diesels are running generators that in turn run electric motors. The charging power comes from these generators also. Most engines on subs and ships do not run at max power because of overtorquing of the shafts.

This combined with the fact that diesel engines run more efficiently at higher speeds, I would have to say that they get WORSE gas mileage when NOT charging their batteries.

At any rate, it really does not make that much difference because they rarely run on all four of their engines (assuming it is a two shaft sub). Most of the time they are running on one shaft (trail shaft mode) on one engine while on the surface (or snorkeling). This is done specifically to save fuel - but it does limit maximum speed.