The youngster took the drug after her friend found it hidden in an empty cheese and onion Pringles container at Southdown Junior School, Newhaven, East Sussex.
The school informed the police when, thankfully, fellow pupils told a teaching assistant that the little girl had tasted the drug.
Officers traced the cocaine back to dealer Jamie Bartholomew, 31, from Newhaven, and found more than 20 grams of cocaine and a small amount of cannabis at his home.
Bartholomew appeared before Hove crown court and admitted conspiracy to supply cocaine, possession of the drug with intent to supply and possession of cannabis.
His lawyer John Marsden-Lynch said his client was "unable to work at the time and dealt the drug to raise money."
'"He is, or was, in desperate circumstances. It goes without saying he is ashamed of what he has done," he said, adding that Bartholomew had "helped train a boy's under-15 football team."
Judge Michael Lawson told Bartholomew: "You have done a terrible thing. The way the cocaine was found was horrific."
But Bartholomew escaped a prison sentence, instead given a 12-month sentence suspended for two years, ordered to carry out 150 hours' unpaid community work and placed under a curfew for four months.
Christine Terry, executive headteacher of Southdown Juniors, said no children were harmed despite the 10-year-old tasting the cocaine.
"This sort of thing could happen in any school. The most important thing is what you do about it," she told Fox News.
Terrible! How could anyone leave something like that in a school playground?