A Manhattan judge has ordered Mayor Bill de Blasio to release emails he wants kept secret in which he and a close friend — who is also a private consultant to clients with business before the city — strategize on municipal matters.

In a 13-page decision dated Tuesday but released Thursday, state Supreme Court Justice Joan Lobis rejected de Blasio’s argument that the close friend, Jonathan Rosen, is an “agent of the city” whose correspondence should be exempt from disclosure under New York’s Freedom of Information Law.

“Clothing informal relationships such as that of Rosen and the Mayor with . . . [special legal] privilege impermissibly broadens the exception to FOIL, counter to the public interest in transparency in government,” Lobis wrote. “Rosen is a private citizen whose private interests may diverge from those of the City in connection with his representation of his private clients, some of whom conduct business which may be impacted by city policies, such as zoning matters.”

Lobis made her ruling on a lawsuit filed by news outlets seeking the emails’ release after de Blasio refused their previous requests.

Rosen, a longtime de Blasio adviser, is a principal in the political consulting firm of BerlinRosen, which has reportedly seen its business boom since de Blasio took office in 2014.

Dan Levitan, a BerlinRosen spokesman, declined to comment on the lawsuit.

advertisement | advertise on newsday

De Blasio has designated at least five people and their work colleagues as “agents of the city,” informal advisers whose correspondence, the mayor and his lawyers argue, should be exempt from public disclosure — just as the law protects correspondence between official advisers, aides and consultants who have been formally retained. In ruling against the mayor, Lobis noted that Rosen was not “retained.”

Correspondence between other “agents” is the subject of pending legal requests by several news organizations, including Newsday.

On Thursday afternoon at a midtown event, de Blasio refused to answer questions about the lawsuit — or anything else except a marginal tax on home purchases above $2 million he was promoting but which lacks support of the necessary Albany leadership.

“Guys, you can ask all you want. Here’s what we are here to talk about,” he said in reference to the marginal-tax plan.

De Blasio ended the news conference after reporters tried to ask him questions about the white military veteran from Baltimore accused of fatally stabbing an elderly black man after, the NYPD said, he traveled to New York City with the intent of harming black men.

The mayor also wouldn’t discuss the arrest of a Jewish teenager in Israel in connection with multiple threats against Jewish institutions in the United States.

“This is how we set things up, guys,” de Blasio said in rejecting questions on the two sensitive topics. He added: “You don’t want to be a part of it? You don’t have to come. If someone has a question on this, ask about this; if you don’t, that’s cool.”