Pirkei Avot 1:6
(6) Yehoshua ben Perachiah and Nitai of Arbel received from them. Yehoshua ben Perachia says, “Make for yourself a mentor, acquire for yourself a friend and judge every person as meritorious.”
Bartenura on Pirkei Avot 1:6:3
(6) “and judge every person as meritorious:” when the matter is hanging in the balance and there is no way to decide it in this way or that way. For example, a man from whose actions we do not know if he is righteous or wicked, who performs an act that is possible to judge favorably and possible to judge unfavorably, it is pious to judge him favorably. But it is permissible to judge a man who is established to be evil unfavorably. As they only stated (Shabbat 97), “one who suspects righteous people is afflicted on his body” – [and so] it is implied [from this] that one who suspects evildoers is not afflicted.