Catalyzes the dehydrogenation of D-galactose by either NAD(+) or NADP(+). Oxidizes following sugars in decreasing order: D-fucose > D-galactose > L-arabinose > 2-deoxy-D-galactose >> 4-deoxy-D-galactose > 2-deoxy-2-amino-D-galactose. D-galactose + NAD(+) = D-galactono-1,4-lactone + H(+) + NADH Optimum pH is between 9.1 and 9.5. Carbohydrate metabolism; galactose metabolism. Homodimer. Belongs to the Gfo/Idh/MocA family.