The judge in the Tulisa Contostavlos trial said evidence given by undercover reporter Mazher Mahmood was "entirely inconsistent".
Explaining his decision to throw out the trial, Alistair McCreath said the prosecution's case had become "tainted" by "serious misconduct".
Before the start of the trial, Contostavlos' lawyers had attempted to have the prosecution "stayed", meaning it would have been thrown out before beginning.
The court hear that there was a problem with evidence provided by a driver called Alan Smith, who originally said he had heart Contostavlos speaking disapprovingly about drugs when she was in his car.
He then "changed his mind", after a conversation with Mahmood, the court was told.
At a pre-trial hearing, Mahmood denied having had any conversation with Mr Smith about what Contostavlos had said.
But the judge said when asked about the same topic during the trial, Mahmood gave answers that were "entirely inconsistent".
More top news
Twenty-one-year-old pair raise nearly £40,000 in the world's toughest row.
An 11-year-old boy has been found guilty of shooting dead an eight-year-old girl in a row over a puppy.
A picture of a mother and her two daughters posted on social media has left people wondering "who's the mum?".