It would be absolutely disgusting for anyone to make this statement, agreed. Luckily Pep didn't say that, and added the caveat that Mendy's private life was not under his purview. The compliment was in response to a question put to him on the stand.
And if the defense attorney tries to make this connection, that since Mendy was an excellent employee he possibly couldn't rape, the prosecution should immediately refute that.
I also think it's important to remember that in the setting he is, he's literally innocent until the prosecution convinces the jury he's guilty beyond reasonable doubt. I'm not aware that's happened yet. As heinous as the crimes he is accused of doing are, he remains that... accused, and is entitled to all the rights such have. Such as character witnesses.