Pupils at a Kent secondary school will provide mouth-swab samples when drugs testing is introduced next year.
Each week a computer will select at random 20 children at Abbey school, Faversham, to take a drugs test.
Two swabs will be taken. The first is for analysis, with results returned three days later. The second will be kept in a secure place in case the student wishes to appeal and take further tests.
Peter Walker, the school's head, said: "Prevention is better than cure - and if drugs testing stops many from taking the first step towards drugs, I'll be pleased."
Mr Walker intends to evaluate the scheme after six months. He has the support of parents, governors and members of staff. Only one parent said he thought his child's rights were being violated.
Parents' permission is required before a swab can be taken, but even then a pupil has the right to refuse. In that case, the school will write to the parents and inform them of their child's decision.
If a drugs test proves positive, a team of social services advisers, police officers and drugs counsellors will be available to offer guidance to the child.
Mr Walker said: "I do not permanently exclude a child who has been found to have taken drugs - but I do if a child is found to be dealing in school."
Gareth Crossman, policy director of the civil rights group, Liberty, said:
"Children are being coerced into a drugs test because if they do not their parents will be told. This is making it difficult for them to refuse and will make them feel as though they do not have a choice."