* Kenyatta lead shrinks in Kenya vote count
* Rival Odinga challenges count, says results "doctored"
* Electoral commission says count credible, won't halt tally
* Kenyans wary about repeat of post-2007 vote violence
(Adds comment from Odinga camp, updates latest tally)
By Duncan Miriri and Richard Lough
NAIROBI, March 8 (Reuters) - Kenya's presidential race tightened on Friday with frontrunner Uhuru Kenyatta gaining just under half of the ballots counted four days after the vote, raising the prospect of a tense run-off against his main rival Prime Minister Raila Odinga.
Kenyatta, 51, the deputy prime minister who is due to go on trial at The Hague on charges of crimes against humanity linked to the violent aftermath of the last election in 2007, has led since results started trickling in after polls closed on Monday.
Results from strongholds loyal to Odinga, 68, closed some of the gap, but with about a fifth of constituencies still to report, Kenyatta could yet secure more than 50 percent of the vote, the level needed for a first-round victory.
The count, questioned by both sides but which international observers broadly said was credible, is likely to go down to the wire.
The poll is seen as a critical test for Kenya, East Africa's largest economy, after its reputation as a stable democracy was damaged by the bloodshed that followed the 2007 election. Much will rest on whether the final result is accepted, and whether any challenges take place in the courts or on the streets.
By 4.00 a.m. ET on Friday, with 9,760,168 total votes tallied, Kenyatta had 4,835,482 votes or 49.5 percent, to Odinga's 4,316,005 or 44.2 percent, according to a display by the electoral commission. That was based on votes reported from 223 of 291 constituencies.
As counting has progressed, Kenyatta's tally has been nudged above and below the crucial 50 percent mark. If no candidate achieves more than that level, the top two go to a run-off tentatively set for April.
The Kenyatta and Odinga camps have both raised concerns about the process, so legal battles could dela that, heightening tensions in the divided nation. But this time, both sides have promised to turn to legal channels and keep the peace.
International observers have said the vote and count have been transparent so far, and the electoral commission has promised a credible vote. Yet Kenyans are still in the dark about the outcome.
The United States and other Western nations, big donors that view Kenya as vital in the regional battle with militant Islam, have already indicated that a victory by Kenyatta would complicate diplomatic relations.
Kenyatta, son of Kenya's founding president, Jomo Kenyatta, and his running mate, William Ruto, face trial at the International Criminal Court in The Hague on charges of unleashing death squads after the 2007 election. Both men deny the charges and have said they plan to clear their names.
Turnout had been estimated by election officials at more than 70 percent of the 14.3 million eligible voters. Yet, that level has almost been reached with no clear idea of how many votes still need to be tallied.
Reflecting how voting tends to run along ethnic lines rather than ideology, constituencies in tribal strongholds of the leading hopefuls often report results that show more than 90 percent or more of votes going to one candidate. That means the remaining constituencies to report could have a big impact.
Kenyatta comes from the Kikuyu tribe, Kenya's biggest ethnic community accounting for about a fifth of Kenya's 40 million people, and Odinga is a Luo. Neither can rely solely on their own tribal supporters to win and both have running mates from other tribes to beef up their support.
Odinga's camp raised the strongest challenge to the process on Thursday, calling for counting to be stopped saying it lacked integrity and some results were "doctored."
In an encouraging sign, Chris Mandumandu, a senior official in Odinga's coalition, said the group was considering a legal petition to challenge the count, reflecting confidence in recent reforms to the judiciary that have made it more independent.
When Odinga lost in 2007, he said he did not pursue a legal route because the judiciary could not be trusted. Resulting tensions spilled over into bloodshed.
Many Kenyans say this vote has been far more transparent. One international observer told Reuters: "I have seen nothing to indicate that the election is not credible."
European Union Ambassador to Kenya Lodewijk Briet said the vote-counting was sound and should be allowed to continue.
"As Chairman Hassan has just said, it should not be stopped midway. It should continue," Briet told Reuters. "If people have a problem with the integrity, the legal disputes settlement mechanism exists and should be followed."
The Kenyan shilling has swayed against the dollar, gaining on reassurances of a smooth counting process and buckling on concerns that delays in announcing a winner would prompt rivals to challenge the election outcome. Analysts said a run-off would unnerve markets by prolonging the uncertainty.
Kenyatta's Jubilee coalition has complained about delays in the count and challenged the commission over its decision to include rejected votes in calculating the final tally.
Rejected votes are for now running at more than 90,000 and could help tip the balance in favor of an outright win for Kenyatta if they are excluded from the final calculations.
(Additional reporting by Yara Bayoumy and George Obulutsa; writing by James Macharia and Edmund Blair; editing by Philippa Fletcher)