There are two commonly known halachic concepts. "Marit Ayin", a bad impression, and "Dan Lekaf Zechut", "Judging favorably". Here is a nice article on the concept of Marit Ayin and it briefly talks about the contradiction between the two concepts.
In the article, it discussing the argument about whether you are allowed to create new situations of "marit Ayin" that were not previously recorded or used in the Talmud. As the use case of Non Dairy Ice cream makes clear, most people don't make new use cases.
However, for those who argue that you can make new use cases for this concept, aren't we violating one commandment to enact another?
To phrase the question more directly, if I assume that somebody will think that I am breaking a halacha by doing a certain action, aren't I also assuming that said person will be breaking a commandment to not judge me favorably? Aren't I commanded to judge the outside viewer favorably, and to believe that he will also follow the commandment and judge me favorably? (This is a different question than the one raised in the article, which is just discussing conflicting halachic principles.)