It is the ability to tell good people from bad people just by observing them. It is like being a good judge of character, a connoisseur of human nature. I would like to find a single word that succinctly captures this characteristic.
For example, there is a fictional character called Daryl Dixon in The Walking Dead who is said to have the ability to tell good from bad. Here is a more detailed explanation for you to get a better idea (spoilers ahead so I used the spoiler tag):
In the TV series version, in Season 5, Rick and his group arrives to a safe zone called Alexandria which is a walled-off community. They are invited to this place by someone who is called Aaron. He is a recruiter of this community who tries to find people outside that can be helpful to the community. (with the help of his partner Eric who was injured in one episode). One night, Aaron reveals that he wants Daryl to be Alexandria's recruiter because he doesn't want to risk Eric's life anymore and Daryl can tell the difference between a good person and a bad person.2
Interestingly, it is also said that our ability to tell good from bad is universal and unlearned. It is based on a study1 where it is found out that babies as young as six months old are able to tell friend from foe. But this should apply to only basic distinction as an instinct to survive. The context I provided suggests being experienced also.
The words that came to my mind were discerning and sagacious but they are about showing good judgement and having a keen insight in general. I think there might be a more precise term for this.