WASHINGTON — A federal judge on Tuesday threw out the conviction of a business associate of the former national security adviser Michael T. Flynn, saying prosecutors had failed to offer enough evidence to sustain their charges that he had secretly lobbied on behalf of Turkey.

Judge Anthony J. Trenga of the United States District Court for the Eastern District of Virginia wrote in a lengthy opinion that there was no evidence of “any actual or implied agreement” between Mr. Flynn’s partner, Bijan Kian, and the government of Turkey. “The government has failed to offer substantial evidence from which any rational juror could find beyond a reasonable doubt” that Mr. Kian had acted as an agent of a foreign power without notifying the Justice Department as required by law, Judge Trenga said.

The judge’s decision, overturning a jury’s July verdict, delivered a potentially fatal blow to the government’s efforts to prosecute Mr. Kian in a case that had already suffered other setbacks.

Mr. Flynn, a central figure in the case, had abruptly changed his story before the trial, prompting prosecutors to scrap him as a witness. And after defense lawyers asked the court to toss the case before it went to the jury, Judge Trenga considered the motion, describing the case as speculative and circumstantial. But he let the trial move forward, and the jury quickly convicted Mr. Kian on two counts: conspiracy to violate lobbying laws and failure to register as a foreign agent.