A Superior Court judge Tuesday denied a motion to dismiss public corruption charges against former state treasurer Tim Cahill, paving the way for a trial.

Prosecutors say Cahill ran a $1.8 million advertising campaign for the state lottery in 2010 to boost his campaign for governor. As treasurer, Cahill oversaw the lottery.

Cahill, who finished a distant third in the election, is accused of violating state ethics laws and procurement fraud. In announcing his indictment in April, Attorney General Martha Coakley said Cahill orchestrated an effort to use the lottery ads to “unlawfully assist” his campaign.

Advertisement - Continue Reading Below

The trial is scheduled to begin Oct. 29. A lawyer for Cahill, Brad Bailey, said Tuesday that dismissal motions are usually denied, and that he looks forward to presenting his case to a jury.

Cahill has maintained he did nothing wrong and that the advertisements were meant to promote the lottery.

But at a hearing last month, prosecutors said Cahill’s use of his position for political gain was almost akin to direct embezzlement.

The ads did not mention Cahill by name, but highlighted the money the lottery provides for cities and towns and said, “That’s the result of a consistently well-managed lottery. And luck has nothing to do with it.’’

Under criticism from Attorney General Martha Coakley, Cahill pulled the advertisements about two weeks before the election. He received just 8 percent of the vote.