Former Mayor Bill de Blasio said it wouldn’t be a good idea for Assemblymember Yuh-Line Niou to run against Democratic primary winner Dan Goldman on the Working Families Party line in November.

“I’m someone who very much appreciates the history of the Working Families Party and I think they’ve done a lot of good in this state,” the former Met told Errol Louis on “Inside City Hall” Thursday, saying he believes voters will go for the Democratic candidate during the midterm elections.

“I don’t find that particularly productive,” he said of the idea being pushed by Niou’s allies, including 2018 gubernatorial candidate and actor Cynthia Nixon.

Late Tuesday night, The Associated Press projected Goldman the winner in the very crowded 10th Congressional District’s Democratic primary. He led the second place Niou by roughly 1,300 votes with thousands of absentee ballots remaining to be counted. Niou has yet to concede.

De Blasio initially ran to represent the district, which spans Lower Manhattan and brownstone Brooklyn, but dropped out.

When asked if he was surprised with how the election turned out, de Blasio said he’s “saddened to see that level of self-funding,” referring to Goldman, who put more than $4 million of his own money into the race.

Goldman, an heir to the Levi Strauss & Co. fortune, said on “Inside City Hall” Wednesday that since it was a short race, he had to decide whether he was going to spend most of his time fundraising to make television advertisements or go out and speak to voters.

De Blasio said he fought against what the Supreme Court’s Citizens United decision and the increasing flow of money into American politics.

“I’d really prefer it if candidates would not do that. I think it is not fair. I think it doesn’t encourage public trust ultimately,” de Blasio said. “This was unusual because it was such a brief election. So that to me is the problematic piece. But no, all things considered, the outcome doesn’t surprise me.”

He added that when it comes to fundraising campaigns, there should be government funding or a public-matching system like New York City has for municipal races. He also called for tighter limits and real penalties if candidate self-funds or goes outside the system.

“That to me is not the kind of democracy that we should have,” he said.

Although de Blasio has left electoral politics for now, he’s going to teach at the Institute of Politics at the Harvard Kennedy School as a visiting fellow for the fall semester.

“I hope to be able to give perspective, bring some real life perspective of running this city, what worked, what didn’t, but I really am optimistic because my experience over the last eight years was overwhelmingly, to me, a positive one,” he said. “So I really look forward to getting to know the faculty but also, of course, the young folks who will ultimately be the leaders of this.”

He said he was going to teach about his time in office, including his major policy achievements securing universal pre-K and leading the city through the first years of the COVID-19 pandemic.

De Blasio also offered his insight into the Democratic party’s prospects in November’s midterms.