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
Cooler in the north, feeling close further south as moisture and heat build up
The first British boxer to win an Olympic gold medal beat Andre Dirrell in Boston last night to fight his way into the history books.
Louis Walsh reignites the flames of his row with by claiming she would refuse to be an X Factor judge if Nicole Scherzinger returns.