The ruling Liberals have been in power for 12 years but recent polls show Martin's minority government is likely to be ousted by the opposition Conservatives amid anger over a major kickback scandal and other suggestions of wrongdoing.
Martin said he had apologized for "a disgraceful period" but doubted the ability of the Conservatives to govern, saying their policies would plunge Canada back into a budget deficit.
The Liberals started the campaign in late November with a five-point lead in the polls, but have steadily lost ground amid repeated questions about their ethics.
"How many criminal investigations are going on in this government?" Harper asked Martin in one of several heated exchanges during the debate, which took place in Montreal.
Martin energetically defended himself against the attacks but it was not immediately clear whether he had done enough to reverse his party's slide in the polls.
Opposition parties brought down the government in November over cash kickbacks to senior Liberal Party members from a government advertising program designed to counter separatist sentiment in the French-speaking province of Quebec.
"I believe that that kind of corruption requires accountability," said Harper.
LIBERALS TRAIL IN POLLS
A Strategic Counsel poll for The Globe and Mail newspaper on Monday showed the Conservatives with the support of 37 percent of voters, with the Liberals trailing at 29 percent.
The lead - one of the largest the Conservatives have enjoyed in the campaign - shows Harper would be returned with a minority government if the election were held now.
Martin, who has consistently tried to portray Harper as an extremist bent on curbing personal freedoms, promised to change Canada's constitution so that Parliament could not overturn Supreme Court decisions on major issues like gay rights.
"I think you're a bit desperate when you create constitutional policy in the middle of a national debate," Harper said afterward. "Mr. Martin's trying to change the channel from ongoing scandal and accountability problems."
Liberal fortunes really began to slide after the Royal Canadian Mounted Police announced last month they were probing whether someone in the office of Finance Minister Ralph Goodale had leaked sensitive information about changes to tax policy.
Martin brushed off opposition demands that Goodale step aside.
"The buck has to stop somewhere and the question is: do you understand that it needs to stop with you?" New Democrat leader Jack Layton asked Martin.
Martin, complaining about what he called "drive-by smears," said he was committed to clean government.
During his campaign - widely criticized as uninspired and too low-key - the prime minister has focused on the Liberals' economic record over the last decade.
The government's budget is in surplus and the country's jobless rate is at 30-year lows. Martin said Canada could not afford Harper's plans to cut taxes and boost spending and asked: "How will he pay for all of this?"
But the debate returned again and again to the scandals, which boosted support for the separatist Bloc Quebecois party. Bloc leader Gilles Duceppe also took part in the debate.