Well,there are three issues with the idea.
1. Lie detectors aren't the most accurate. You can train to pass them, they can give false results.
2. As much as I'd like an easy way to remove corrupt, do nothing, obstructionist, terrible public officials like say, Mutch McConnell, they do have their 5th amendment rights against self incrimination and there are rules for removal of bad elected officials. They should use the rules more often, but making up a test like this would be a bad idea.
3. Politicizing the test would be an issue. If they are already shielded by the 5th amendment from confessing criminal acts, what other questions would you have, biased policy ones that would likely cause issues with the already not steller lie detectors?
How stupid are you? I'm not sure there is an end to your stupidity.
If you really want to drain the swamp, overturning the ability for corporations to funnel ungodly amounts of cash into influencing politicians, make politicians financially transparent, make sure that politicians actually do their jobs and vote on measures that are brought up, fill seats as needed in positions of government, that sort of thing.
The main reason for the "Swamp" is you have a group of politicians who want the government to fail and get rich while doing so.