KABUL—Secretary of State John Kerry arrived in Afghanistan to try to broker an election-audit deal between presidential candidates as a deepening crisis threatens to fragment the country along ethnic and regional lines.

Former Finance Minister Ashraf Ghani emerged as the apparent winner, with 56.4% of the vote, in preliminary results from a June 14 runoff. Former Foreign Minister Abdullah Abdullah rejected the results, charging...