MEL B was a “habitual, frequent and continuous user” of drugs and booze, bombshell court documents claimed.
The ex-Spice Girl, 43, was ordered by a judge to undergo four months of random drug tests in Los Angeles.
Officials can turn up at her pad in West Hollywood at any time to take blood and urine tests.
Judge Mark Juhas said there was evidence of repeated substance abuse after evidence from her former nanny Rusty Updegraff.
The singer has been embroiled in a bitter custody fight with former husband Stephen Belafonte, who she has accused of abusing her.
Now both Mel B and Belafonte must pay for four months of random drug testing.
At the Los Angeles Superior Court, Judge Juhas also ordered the pair to hire a new nanny to be there when they are looking after their six-year-old daughter Madison.
Last night a pal of Mel said: “She continues to say that Stephen has orchestrated this as a ploy to gain full custody.
“The next few months are absolutely vital in her life and career.”
It comes after Rusty claimed he saw the star “use cocaine pretty regularly” and would ask him to get the class A drug.
The singer has denied abusing drugs but vowed to head to rehab in the UK for Post Traumatic Stress Disorder.