Accused Chelsea bomber Ahmad Rahimi is not entitled to have his trial moved out of New York on the basis of prejudicial pretrial publicity, a Manhattan federal judge ruled on Monday.

Lawyers for Rahimi, 29, of Elizabeth, New Jersey, had moved to shift his trial to either Washington, D.C., or Vermont, based on a survey showing that massive early publicity demonized Rahimi and nearly 50 percent of potential jurors thought he was guilty.

Manhattan U.S. District Judge Richard Berman said much of the publicity had died down since last year and he believed questioning of prospective jurors could weed out bias.

“The court doesn’t believe that the media accounts require . . . that a fair jury can’t be empaneled,” Berman said in a decision he read from the bench after hearing arguments. “Indeed, the court believes the opposite is true.”

The judge said 72 percent of prospective jurors in the defense survey reported they could set aside negative views of Rahimi, and noted that a long list of high-profile cases, from terrorists to mob boss John Gotti, were successfully tried in federal court in Manhattan.

“There is substantial diversity as to race, socioeconomic status and national origin,” he said.

advertisement | advertise on newsday

Rahimi is charged with planting two bombs in Chelsea last September, one of which exploded and injured 30 people. He also faces charges in New Jersey for planting bombs there, and for a shootout with police when he was captured.

Defense lawyers complained that former Manhattan U.S. Attorney Preet Bharara poisoned the pool of prospective jurors by tweeting that Rahimi “attacked” the “American way of life” and inaccurately claiming the bombing suspect would face “terrorism charges.”

Rahimi is scheduled to go on trial in October for using a weapon of mass destruction and explosives, and destruction of property crimes, but is not charged with terrorism or aiding a terrorist group.

Earlier Monday, the judge denied a request from prosecutors that he make a determination of Rahimi’s mental competency to stand trial, based on concerns about his “mental health” that came up during plea negotiations with the defense earlier this year.

Prosecutors said the request was a precautionary measure, but they didn’t actually doubt his competency. Defense lawyers said Rahimi has “significant mental health issues” in the wake of injuries he suffered when captured, but they never doubted his competency.