Hafetz Haim Halachot
Halacha 67 / 215

Hilchos Lashon Hara, chapter 3, section 7

Here is a big and basic rule in these matters: judging people favorably (giving them the benefit of the doubt).

Suppose a person sees someone say or do something – whether it is between a person and Hashem, or between people – and it can be understood in a good way or a bad way:

• If that person is G-d-fearing, one must judge them favorably, even if, by simple logic, the bad explanation seems more likely.

• If that person is average – sometimes careful about sin and sometimes not – and both sides are equal, it is a mitzvah to judge them favorably. As our Sages said: "If someone judges his fellow favorably, the Omnipresent will judge him favorably." This is part of Hashem's command: "Judge your fellow righteously."

• Even if the matter leans more to the bad side, it is very proper to treat it as a doubt and not decide that it was bad.

And if the matter leans more to the good side, but a person judged it as bad and then went and spoke badly about them – besides breaking "Judge your fellow righteously," they also broke the prohibition of speaking lashon hara.