Police were called to Merchiston Castle School in the capital on 24 November following the discovery of cannabis in a 15-year-olds study.
The boy’s parents removed him from the school before he could be formally expelled.
Pupils in his S4 group were also interviewed but there was no evidence the boy was dealing to other pupils.
But now the headmaster at the all-boys boarding school confirmed that he is seeking legal advice on whether the school can introduce random drugs tests.
This is the first time random drug testing in a Scottish school has been mooted since 2006 when the then Scottish Executive rejected calls for them in state schools.
Andrew Hunter, who has been headmaster at Merchiston Castle School for 13 years, said: “I’ve decided that in the school it might actually be better for the whole school community that we have a drug testing policy not dissimilar to the armed forces. In other words, random drug testing.
“I don’t want to infringe on any human rights, hence seeking legal advice, but we are thinking of bringing in quite a right-wing policy.
“We need to support young people to the hilt, so at least when they are in that challenging position they think they could fail a drugs test and lose their place in the school immediately.”
Founded in 1833, the school takes pupils aged eight to 18. Its former pupils include comedian Danny Bhoy and Lord Laidlaw, one of Britain’s richest men.
The school’s drug policy states that pupils found in possession of class A or B drugs “will usually be asked to leave the school.”
Mr Hunter said that both parents and pupils will be consulted on any potential introduction of the random tests.
But the move has brought criticism from Scotland’s Commissioner for Children and Young People, Tam Baillie.
He said: “Schools should be promoting the rights of all children and young people.
“This reported initiative interferes with children’s right to privacy and to have their dignity respected.
“Schools have a responsibility to raise children’s awareness of the risks of drugs use in a positive learning environment, yet this approach is based on a blanket suspicion of all pupils.
“It has the potential to damage the trust between the school and the pupils with little or no gain. There is no robust evidence base that this action will have any positive impact.
“I would urge the school to think again about how it responds to the legitimate concerns around young people’s drug use.”
The legality of the tests was thrown into question by Aiden O’Neill, founder of the Scottish Human Rights Law Group.
He said: “There is no absolute ban on people imposing drug tests, but there might be an argument it was disproportionate.
“It happens in the work place, but that’s different as people sign on to that. Children don’t. There is no voluntarism there.”
But Professor Neil McKeagney, head of the Centre for Drug Misuse at the University of Glasgow, was supportive of the plans.
He said: “It is very well worth exploring random drug testing to see if it is an effective means of reducing levels of teenage drug use.
“The evidence is not yet clear-cut. From the US there is some evidence that schools have drug-testing programmes have a lower level of drug use than those that don’t, but other studies have questioned that.
“But generally it is something parents and pupils themselves are supportive of.
“It is very brave of the school to be supporting this. Random drug tests are something very few schools have been involved in.”
A Lothian and Borders Police spokesperson said: “Police were called to Merchiston Castle School after a small quantity of drugs were found on the premises. The matter was investigated and a report was submitted as a result.”