Do not judge your friend until you reach his level. (Avot 2:5)
Judging others favorably applies not only to sinners, but even to our enemies who would harm us. In most cases, enmity between two people stems from petty jealousy. Either I am jealous of my friend, because he has more or has accomplished more than I have, or else he is envious of what I have or of what I have achieved. We are not equals in the area where the jealousy exists.
Rebbe Nachman tells us to endeavor to be with him in one place… Then there will surely be no opposition, for within uniformity no opposition is possible.
If we were, there would be be no reason for envy. Either I have to raise myself to his position or, if he is on a lower level than I am, I have to elevate him and make him my equal. How? Easily, I judge him favorably. Then, when there are no longer differences between us, there will be no room for jealousies and nothing to fight about. (Based on Likutei Moharan I: 136)
Excerpt from Crossing the Narrow Bridge, by Chaim Kramer