* Opposition leader challenges Putin ally for Moscow mayor
* Investigators examine Navalny's campaign funding
By Gabriela Baczynska
MOSCOW, Aug 12 (Reuters) - Russian prosecutors accused opposition leader Alexei Navalny on Monday of illegally receiving foreign funding for his campaign to oust an ally of President Vladimir Putin as Moscow mayor in an election next month.
Navalny, 37, said the allegations were an attempt to discredit him, and showed the Kremlin was worried that his door-to-door campaigning style was reducing acting Moscow mayor Sergei Sobyanin's big lead in opinion polls.
"Our campaign is the most transparent in terms of financing," Navalny, who could face criminal charges if the allegations were confirmed, said on his website, dismissing the state prosecutors as "dullards".
The election pits the man who emerged as the opposition's informal leader in protests last year against an experienced politician who was appointed by the Kremlin as Moscow mayor in October 2010 and has been touted as a potential prime minister.
Navalny, who has a five-year jail sentence hanging over him after being found guilty of what he said were trumped-up theft charges, has often been accused by Kremlin allies of being a Western stooge - a charge he denies.
He has been able to run for mayor on Sept. 8 only because he was unexpectedly freed on bail the day after his sentencing last month on charges of stealing from a state timber firm while he was advising in the remote city of Kirov in 2009.
KREMLIN HOPES TO DISCREDIT NAVALNY
The unusual decision to free him on bail was widely seen as being backed by the Kremlin so that he could contest - and lose - the election to Sobyanin, discrediting the opposition and reducing his appeal before he starts his jail term.
With opinion polls giving Navalny up to 15 percent support, compared to Sobyanin's 75 percent, the white-haired Kremlin ally is strong favourite to win.
But Navalny, an anti-corruption campaigner who has caught the mood of the urban youth, believes he might have a chance of victory if Sobyanin fails to secure a simple majority in the first round.
The funding allegations were made by the nationalist Vladimir Zhirinovsky, leader of the Liberal Democratic party, which often backs Putin's policies.
"Checks have confirmed information about foreign funding of A. Navalny's election campaign," the Prosecutor General's office said in a statement, adding that more than 300 foreign individuals or legal entities had contributed to his funding.
Navalny said in response that all the donations accepted for his campaign had come from Russian citizens, although some could be living abroad or on holiday outside Russia. Foreign funding is banned under Russia's election law.
A heavy defeat on Sept. 8 would be a blow to the opposition, as Navalny is its most powerful public speaker. His campaigning in a casual T-shirt is a contrast to Sobyanin's more formal and choreographed public appearances, usually in a suit and tie.
Even if Navalny does not win, a strong performance could lift the opposition's morale, sapped by the failure of protests in late 2011 and 2012 to stop Putin's return to the presidency after four years as prime minister.
Since that return, Russia's parliament has adopted a series of laws seen by critics as designed to crack down on opponents.
They included forcing NGOs that receive foreign funding and are involved in politics to register as foreign "agents" - a tag that has echoes of the Cold War and espionage.
Putin also forced out the U.S. state aid agency, USAID, accusing it of trying to meddle in Russian politics. (Additional reporting by Darya Korsunskaya; Editing by Timothy Heritage and Mike Collett-White)