Something can be a logical fallacy while still being epistemologically justified. That's because logic is not an a priori description of reality; it's just a system for making inferences that happen to often be useful models of reality. But if I change my system of logic (e.g. move from accepting to rejecting the law of the excluded middle) then one set of fallacies disappears and another appears.