In Harry Potter, people are differentiated based on their ability to do magic, and whether or not they are descended from people who are able to do so. "Muggles" are people who can't do magic. Wizards and witches can. Pure-bloods are witches and wizards descended from magical family on both sides. I am unsure how far they are supposed to be able to trace their lineage back. (One generation? Two? The more the merrier?) Half-bloods have magical family on one side but not the other. Muggle-borns, sometimes referred to by the fictional derogatory term "Mudbloods", are witches and wizards descended from Muggles on both sides. "Squibs" are muggles with magical parentage.
On the side of Dumbledore, most of the Weasely family, and Harry Potter himself, we see people who believe that parentage has nothing to do with how skilled a witch or wizard is, and that Muggle are people who, generally speaking, are worth of respect, but simply lack the ability to do magic. Muggles should be free to go about their ordinary lives without interference from or even knowledge of witches and wizards. Harry Potter dislikes his own aunt, uncle, and cousin, who are Muggles, but that is because of how they treat him, not for their inability to do magic. Although he takes advantage of his status as a wizard to frighten his cousin Dudley, who has been abusive toward him for many years, that dislike doesn't stop him from defending Dudley when a magical dementor attacks them.
On the side of Voldemort, the Death Eaters, and others, we see people who think that the skill of being able to do magic makes witches and wizards "better" than Muggles, not merely in the sense of having a skill, but on a basic, moral sense. To Voldemort, being a wizard gives him the right to kill Muggles like one might squash a bug. Furthermore, Voldemort and others similar to him think lineage makes some wizards better than others. Purebloods deserve the most respect, halfbloods are tolerated, and muggle-borns are seen as little better than Muggles.
There appear to be parallels between the hatred of muggles and muggle-borns displayed by Voldemort and others, and real-life racism. Ironically, Voldemort is a half blood himself. He is proud of his mothers side, on witch he can trace his lineage all the way back to Slytherin, an ancient wizard who also hated muggle-borns. On the other hand, Voldemort his so ashamed of his father's side, the Muggle side, that he changes his name. Looking at history, it is well-known that Hitler had Jewish ancestry. Is Voldemort's hypocrisy metaphoric of Hitler's?
Much as racist groups in history have used symbols, Voldemort and his death eaters use something called the Dark Mark. They put it over someone's home after they've killed someone. This gives the Dark Mark the power to terrify all by itself, just as people are still frightened and outraged by symbols that were used by the Nazis, the Ku Klux Klan (KKK), and other racist groups. They call people "Mudbloods" while terrorizing them, which similarly gives that word the power to frighten and anger, much as racial slurs used against black people when they were enslaved legally in the U.S. and racial slurs used against American Indians while they were being persecuted and slaughtered continues to frighten and anger people even today.
By making every reader a member of the persecuted group (because, after all, the reader is classified as Muggle), J.K. Rowling shows everyone equally what its like to be persecuted for a fact of your birth. By using only fictional distinctions and fictional symbols of hatred, she avoids causing offense that often comes from discussion of real symbols of hatred. And like Animal Farm can be read as a children's book about animals rather than a statement about communism, so it is entirely possible to read Harry Potter as a children's book about magic.
Although Rowling avoids discussion of actual racism, she does introduce us to racially diverse characters.
It is also possible to read Harry Potter as a metaphor for persecution against disabled people. Like blind people lack the ability to see, deaf people lack the ability to hear, and mute lack people the ability to speak, Muggles in the Harry Potter universe lack the ability to do magic. Since all readers are Muggles, this affords all readers the opportunity to see the ridiculousness of eugenics. A blind man's life isn't any less worth living because he cannot see than yours is because you cannot do magic.
However, the series lacks many disabled characters, and most of those who are disabled have disabilities of the magical variety. Thanks to magic, Moody's eye is replaces with a magical substitute that works even better than the original. Harry Potter's bones are regrown over night. Even temporary things like the common cold are quickly cured.
However, Firenze, a centaur, requires groundfloor accommodations due to being four-legged. I guess all the witches and wizards at Hogwarts couldn't figure out how to make the magical equivalent of an elevator. Lupin is a werewolf, through no fault of his own. There is no cure, but although he takes measures to manage his condition, and although he's the best Defense against the Dark Arts teacher we see in the series, he is still persecuted for it. This is metaphoric of the irrational fear people often have of people with real incurable illnesses and disabilities.
What other metaphors for persecution do you see in the Harry Potter series?