United States secretary of state John Kerry said Afghanistan's transition to a self-reliant state hung in the balance after a contested presidential election.

Mr Kerry arrived in Kabul for talks with the two presidential contenders, Abdullah Abdullah and Ashraf Ghani, incumbent Hamid Karzai and other senior figures and urged Afghan officials to focus on auditing the vote count to underpin its legitimacy.

Preliminary results from a June 14 run-off round put Dr Ghani, a former World Bank official, in the lead with 56.4 per cent of the vote - almost one million votes ahead of Mr Abdullah.

Mr Abdullah rejected the result, calling it a "coup" against the people and dismissing the vote as invalid because of widespread fraud. His aides have threatened to set up an alternative administration.

Mr Kerry rushed to Kabul from meetings in Beijing to try to mediate between the camps and guard against any attempt at a power grab.

"The election legitimacy hangs in the balance; the future potential of the transition hangs in the balance, so we have a lot to do," he said as he began his first meeting of the day with United Nations special envoy to Afghanistan Jan Kubis.

"Our hopes are that there is a road that can be found that will provide that capacity for the questions to be answered, for people's doubts to be satisfied, and hopefully for a future to be defined.

"But I can't tell you that that's going to be an automatic at this point."

US officials said Mr Kerry would urge both contenders to agree on a review "of all reasonable allegations of fraud", which would entail additional audits of the vote count.

Mr Kerry was also due to meet Afghan interior minister Mohammad Omar Daudzai, a man tipped as head of a possible interim government - a last-resort scenario possible if the current deadlock is not resolved promptly.

Frontrunner supports vote audit

Ahead of talks with Mr Kerry, Dr Ghani said he favoured a comprehensive audit.

"Our commitment is to ensure that the election process enjoys the integrity and the legitimacy that the people of Afghanistan and the world will believe in," he said.

"Therefore we believe in the most intensive and extensive audit possible to restore faith."

Mr Kerry replied: "No one is declaring victory at this time. The results have yet to be finalised and so those questions have to be resolved and I'm very appreciative that Dr Ghani respects that."

US State Department spokeswoman Jen Psaki told Reuters that an agreement on a broad review of the votes would be an initial step to enable the candidates to talk through their differences.

"Secretary Kerry's goal is to help the parties find a way forward that ensures that the next president of Afghanistan has a credible mandate to lead a unified Afghanistan," she said.

Violence would cause US to withdraw assistance: Kerry

The US believes that the results of the final tally in the second round should not be released until the audits have been completed. Washington considers the results thus far to be preliminary.

Mr Abdullah is a former anti-Taliban resistance fighter. His father is a Pashtun, Afghanistan's largest ethnic group, while his mother comes from the Tajik minority.

Dr Ghani has strong support from Pashtun tribes in the south and east.

Mr Kerry has warned that any effort to resolve the dispute through violence or any "extra-constitutional means" would cause the US to withdraw assistance to Afghanistan.

The US is in the process of withdrawing its forces from the country after 12 years of fighting Taliban insurgents, but remains the country's biggest foreign donor by helping to fund the operations of the Afghan government.

A senior state department official said if Washington withdrew support, other donors would likely follow and that would have a significant impact on the Afghan government's actions.

"Both sides have expressed to the secretary that they want to get to an outcome that is credible, transparent and accepting," the official told reporters en route to Kabul, speaking on condition of anonymity.