It's simple: You have to create a perfect test that can tell good people from bad people, and then build a police force that only hires good people.
The fact is that there are people in this world who are willing to hurt other people for their own advantage. You cannot fix that by giving huge amounts of power to some more or less random selection of the general population. There is no silver bullet, and trying to construct one nonetheless tends to end badly.