The accepted answer misses the point a bit. The reason that these men were sent away was not that they were bad warriors or bad people.
Verse 2:
The LORD said to Gideon, “You have too many troops with you for Me to deliver Midian into their hands; Israel might claim for themselves the glory due to Me, thinking, ‘Our own hand has brought us victory.’
In verse 3, those that want to leave get to leave. Except there's still too many left: 10.000. Hence another sifting process is proposed in verse 4:
“There are still too many troops,”
the LORD said to Gideon. “Take them down to the water and I will sift them for you there. Anyone of whom I tell you, ‘This one is to go with you,’ that one shall go with you; and anyone of whom I tell you, ‘This one is not to go with you,’ that one shall not go.”
This sifting process happens to be lapping vs. kneeling to drink. Only three hundred men lap: these get to go on. There is no reason to accuse the other 9.700 of idol worship: the reason they got sent away is stated in verse 2. Nowhere do they get classified as pagans afterwards. There is also no reason to state that "they must've been bad fighters", because following the reasoning in verse 2, it would make more sense to sent the good fighters away.
So to answer the question: Deciding by drinking if someone is a Jew or a pagan seems to be connected to the history of Gideon, but ultimately, to a rather uncalled-for interpretation of it.