(Reuters) - Presidential candidates traded accusations over political corruption on Friday night in a last ditch attempt to sway undecided voters before Sunday's election runoff in Brazil's closest race in decades.

In the final television debate of a bitter campaign, leftist President Dilma Rousseff and pro-business opposition candidate Aecio Neves sparred over who was best suited to restore growth to a stagnant economy, fight inflation, bring down rents and deal with open sewers in Brazilian cities.

But it was a deepening bribery scandal at the country's largest enterprise, state-run oil company Petroleo Brasileiro SA, that brought the fiercest exchanges.

"There is one easy way to put an end to corruption: throw the Workers' Party out of office," Neves said in reply to a question from a voter on how to improve Brazil's lenient anti-corruption laws.

Polls show that the festering corruption scandal involving the ruling Workers' Party has not had a significant impact on the race in which Rousseff gained a clear lead this week.

In his last chance to win over voters, Neves came out swinging in the debate and asked Rousseff straight out whether she knew about a scam that allegedly received kickbacks from Petrobras contractors and funneled funds to Rousseff's party and its allies in Congress.

The allegations were made in plea bargain statements made by former Petrobras executive Paulo Roberto Costa and a black-market money dealer called Alberto Youssef who were arrested in March in a money laundering investigation.

The weekly magazine Veja reported on Friday that Youssef has told police and prosecutors that Rousseff and her predecessor, Workers' Party founder Luiz Inacio Lula da Silva, knew about the corruption scheme. The jailed money dealer provided no evidence.

Rousseff dismissed the allegation as unfounded and called Veja magazine an opposition mouthpiece that had systematically antagonized her government and was trying to derail her re-election.

Neves, the market favorite who had stirred investor enthusiasm by promising business-friendly policies to pull Brazil out of recession, assailed Rousseff for poor management of Latin America's largest economy and losing control of inflation.

A mild economic rebound and a bruising campaign have boosted the incumbent's chances in recent weeks. Surveys of voters by Brazil's top polling firms published on Thursday showed Rousseff with a lead of 6 to 8 percentage points.

Rousseff has gained ground by reminding voters of the rising wages and expanding social programs many have enjoyed over the past 12 years of Workers' Party rule, benefits she said would be at risk because Neves would govern for the elite.

Neves insisted in Friday night's debate that he would preserve social programs that have lifted millions of Brazilians out of poverty and reduced inequality.

Analysts say the corruption allegations have not swayed voters to turn against Rousseff because unemployment remains low despite the slowdown and many Brazilians enjoy access to consumer goods, education and housing they did not have before.

Rousseff blamed Neves' Brazilian Social Democracy Party for the crisis facing Brazil's largest city Sao Paulo, which is close to running out of water. She said water was the responsibility of the state government run by his party.

"Such a lack of planning in the richest state in the country is shameful," she said.

(Reporting by Anthony Boadle)