Joe Lhota and Bill de Blasio battled Tuesday night at their second mayoral debate over "race-baiting" accusations, public safety and tax hikes, their arguments becoming so heated that at one point the moderator was forced to intervene.

The Democratic front-runner slammed a recent TV ad by Lhota that argued de Blasio's public-safety policies would take New York City back to its most violent years as "race-baiting" and "fear-mongering."

"Mr. Lhota should be ashamed of an ad that divides us," de Blasio said.

Republican Lhota in turn accused de Blasio of inaction as an aide to Mayor David Dinkins during the 1991 Crown Heights riots, which pitted Orthodox Jews against African-Americans. De Blasio said Lhota misrepresented his role and added that he learned that officials must respond to such situations with "overwhelming force."

Dinkins and Rudy Giuliani, Lhota's ex-boss, became attack lines during the second of three hourlong televised debates between the candidates, shown live on WCBS-TV. The candidates accused each other of working for divisive mayors.

"What color is the sky on your planet?" Lhota asked de Blasio after the public advocate said Giuliani held the city back.

advertisement | advertise on newsday

De Blasio retorted, "I didn't know we had different planets. Mr. Lhota appears to have his own planet."

Polls show Lhota trailing 3-to-1. Unlike the first debate, in which he was often on the defensive, "Lhota really came out swinging and seemed really confident and even funny at times," said Jeanne Zaino, an NYU University professor of political science. "The real question is whether it's too little, too late."

Lhota told reporters after the debate that he was "a lot more comfortable being up there."

"Bill de Blasio doesn't have a Plan B," Lhota all but shouted after his rival dodged the moderator's question about alternatives to his tax-the-rich proposal if it dies in Albany. When de Blasio revived his criticism of Lhota's April speech to the Staten Island tea party, Lhota quipped: "You are the Mad Hatter; all you want to do is talk about tea." In post-debate remarks, de Blasio knocked the "Alice in Wonderland" reference as "a little dated."

Lhota was asked why he tagged Mayor Michael Bloom-berg "an idiot" during superstorm Sandy recovery efforts and called Port Authority police "mall cops" at a May forum. De Blasio suggested the gaffes show a temperament problem.

"I have always called it like I see it," Lhota said of the Bloomberg insult during a drawn-out explanation. He said the "mall cops" slam was a moment he most regretted.

In his closing statements, Lhota said de Blasio would threaten the city's safety.

"Do you want your vote to be safe or sorry?" Lhota asked.

advertisement | advertise on newsday

De Blasio, keeping to his theme of fighting inequality, said, "We need a safe city and a fair city."