In the wild, good judgment about what to trust and what to avoid is vital for survival. Wolves, for example, generally opt to avoid conflict rather than risk injury. Though domestic dogs have lived side-by-side with humans for thousands of years, they can still operate from instinct like their wild brethren. Whether they use these instincts to judge human character, however, is debated — though many seem to have personal stories which attest that they do!
Dogs use scent to evaluate people.
Dogs base their choices almost entirely on smell — their primary sense. This is why a mop-topped sheepdog can still navigate the world around him with fur covering his eyes. Thanks to their heightened sense of smell, dogs can pick up a number of cues from human beings.
They can sense fear, anxiety, happiness and other emotions all by reading human scents. Their reaction towards that human probably has more to do with the current emotion they're displaying, and is not a judgement about their overall character.
Dogs often adopt their owners' intuitions.
Dogs are intelligent creatures, to be sure, but they generally look to their owners for information on how to react or behave. For instance, complaints about dogs not liking certain genders or certain races in all likelihood trace back to the anxieties of the owner rather than the dog; the dog is just reading these changes in behavior from the owner and reacting accordingly.
Dogs read the subtleties of human body language.
Behavioral cues in humans, both strangers and familiars, have a big effect on the behavior of dogs. People who act in a manner the dog is used to may make the dog feel calm, while people who act different might make the dog feel uneasy. In some cases, a dog can read a person's behavior and demonstrate guarding behaviors that indicate distress or concern. Whether or not the dog is able to interpret character from a human's behavior is unknown but debated.
A dog may act defensive in the presence of a man you're wary of (if he picks up on your wariness), or the dog may just appear to. What's more, it is not unheard of for a dog to bark at someone on crutches if he has never seen a person on them before — and crutches, of course, reveal little about a person's character. He may be doing so out of surprise, curiosity, or mistrust of the novel objects.
Dogs sense anxiety and fear
Determining whether a person has good character is difficult for humans. There are many different ways to view character and human behavior. The same can be said for dogs; they can read common behaviors, sense anxiety and fear, and analyze the people they meet in relation to what they know, but their reactions are not necessarily based on whether that person is good or bad. They may depend more on changes they sense in you in the presence of certain individuals.