U.S. District Judge Rudoph Randa also ordered prosecutors to return all property seized in the investigation and to destroy all copies of information obtained in the probe.
The conservative organization Club for Growth and its director, Eric O'Keefe, filed the federal lawsuit in Milwaukee in February, arguing the so-called John Doe investigation amounts to harassment and violates conservatives' free speech rights.
In his 26-page order, Randa agreed and issued a preliminary injunction stopping the investigation.
"The plaintiffs have been shut out of the political process merely by association with conservative politicians. This cannot square with the First Amendment and what it was meant to protect," Randa wrote. The judge said O'Keefe and Club for Growth no longer had to cooperate with the investigation.
David Rivkin, lead attorney for Club for Growth, hailed the decision.
"We're gratified by Judge Randa's decision and believe it will begin the process of restoring our constitutionally protected right to free speech and association," Rivkin said.
Milwaukee District Attorney John Chisholm, one of the defendants in the case, did not immediately respond to an Associated Press email for comment Tuesday night.
The investigation grew out of a previous one that lasted three years and ended in 2013 with six convictions, including three former Walker aides. The latest investigation, which began in August 2012, reportedly has been looking into activity by Walker's campaign, the Club for Growth and more than two dozen other conservative independent groups that were heavily involved in recall elections targeting Walker and state senators.
Walker became a national conservative hero, and possible 2016 presidential candidate, after he became the first governor in U.S. history to win a recall election in 2012. He was targeted for recall because of a law he championed, in the face of massive protests, that effectively ended collective bargaining for most public workers in Wisconsin.
Nearly $81 million was spent by the candidates, special interest groups and political committees in the recall race, more than doubling the previous record set by Walker in the 2010 election.
Wisconsin Club for Growth spent an estimated $9.1 million on all recalls in 2011 and 2012, according to the nonpartisan Wisconsin Democracy Campaign.