My sub-genius level dog can detect evil: anyone on that side of the fence. Anyone on this side (or who comes through the gate) is immediately cleansed of all suspicion.
My very intelligent late cat was evil himself, but he did not try to detect evil. Rather, he detected people who were uncomfortable with, or allergic to, cats, and made them the center of his ‘affection’.