In the latest development, just two days before Election Day, the main opposition coalition, the National Super Alliance, accused Mr. Kenyatta of ordering an armed raid on one of its tallying centers. The accusation was reported by some media outlets but dismissed by others as false.
The details of all those events remain hazy and unconfirmed, spawning fears and conspiracy theories among Kenyans already nervous about Tuesday’s vote. Whether those reports are false or simply shoddy journalism, 90 percent of Kenyans surveyed in a report in July said they had seen or heard deliberately fake news, according to GeoPoll, a polling service. This included stories said to have been produced by the BBC and CNN. One news article had the headline “Crooked Raila,” referring to Raila Odinga, who is running against Mr. Kenyatta. The president’s team is reported to have enlisted Cambridge Analytica, the big-data company that worked on President Trump’s campaign.
“There is an ecosystem of fake news around this election,” said Alphonce Shiundu, editor of Africa Check, a fact-checking organization. “Kenyans really don’t know what the truth is.”
Misleading reports combined with a shaky trust in the electoral process — a third of Kenyans have “no trust at all” in the fairness of the electoral commission, according to a nationwide opinion poll — could set off a rerun of the violence seen a decade ago.
Fearful of clashes erupting, thousands of people have already fled major cities, including Nakuru and Eldoret, in the Rift Valley region of Kenya, where some of the worst postelection violence took place a decade ago. Shortly after the 2007 election, about 50 people were burned alive as they sought refuge in a church near the city, in western Kenya. Bus tickets from Nairobi to rural cities are twice the usual price, and flights are overbooked, according to travel agencies.
“After what happened in 2007, no one wants the same,” said Vanity Kosgi, 37, a politician in Eldoret. “People learn.”
Alfred Agisu, 35, the leader of a scraggly troupe of young drummers in Eldoret, urged residents not to succumb to violence. “We make music to preach peace,” Mr. Agisu said.
In a contest that will cost at least $1 billion, according to Kenya’s treasury, more than 19.6 million registered voters will choose hundreds of legislative candidates across the country, in addition to the president and vice president.
“Quite a lot is at stake,” said Justin Willis, professor of history at Durham University in England and an expert on Kenyan politics. “Everyone is working hard to win. People have invested so much — and so much money — that they need to recoup their losses, right up to the president.”
Facing no limits on campaign financing, politicians have spared no expense. They have showered voters with money and even hired helicopters for their campaigns. The common belief is that once voted in, lawmakers, whose official salaries are 25 times higher than those of average Kenyans, will redistribute some of that wealth to their supporters.
Eldoret, for example, is a stronghold of Vice President William Ruto. It has some of the best roads in Kenya. Its city center is a hive of businesses and hotels. There is little garbage on the streets. Outside town, lush cornfields and banana forests stretch as far as the eye can see. (Mr. Ruto’s country estate, which was breached by an unknown assailant who was later shot dead by members of the security forces, has a well-manicured garden decorated with pink bougainvillea.)
If the election is transparent and credible, it will send a powerful message to Kenya’s neighbors, where longtime leaders are holding on to power, as is the case in Ethiopia, Uganda and Rwanda, or have taken a despotic turn, as in Tanzania.
President Kenyatta, 55, who leads the Jubilee Party, will face off against Mr. Odinga, 72, a former prime minister who leads the National Super Alliance. Both men are wealthy scions of post-independence leaders, and their families have largely dominated Kenyan politics for decades.
Mr. Odinga, who is running for a fourth time, says he was robbed of victory in the previous two contests. In 2013, Mr. Kenyatta won by a tiny margin, prompting Mr. Odinga to ask the Supreme Court to invalidate the election. Mr. Odinga is now rousing supporters by warning that this year’s election could also be stolen, which critics say is an incitement to violence.
Mr. Kenyatta and Mr. Odinga were virtually tied in recent polls, but neither is drawing more than 50 percent. They are running on similar platforms — economic development — and have mostly appealed to voters based on ethnic affiliation.
The Kikuyus and Kalenjins, who make up a large chunk of Kenya’s population, are mainly supporting Mr. Kenyatta. The Luos, Luhyas, Kambas and other smaller ethnic groups are backing Mr. Odinga.
For most Kenyans, unemployment and the high cost of living are the dominant issues, intertwined with deep-rooted ethnic allegiances, which were entrenched under Britain’s colonial rulers, who pursued a policy of divide and rule.
Although the economy has been growing at an annual rate of 5 percent in recent years, inflation, partly caused by drought, is whittling away at Kenya’s fragile middle class and creating a vast underclass. Many Kenyans cannot afford to buy staple foods or pay school fees. Electricity and water shortages are common. Youth unemployment is high.
“What do you want us to do, steal?” asked Vincent Losano, an unemployed man in Eldoret. “We need jobs.”
Kenyans, still smarting from past violence, are hopeful that this year will be different. One reason is that the two ethnic groups that fought each other in 2007 and 2008 — the Kikuyus and the Kalenjins — are now in the same camp. (President Kenyatta is a Kikuyu; his running mate, Mr. Ruto, is a Kalenjin.)
Many Kenyans interviewed for this article also expressed optimism that, despite the gruesome murder of the election official, the vote would be fair and credible — as long as the technology did not fail. Kenya will be using biometric technology to identify voters and transmit results electronically, which should diminish the chances of fraud.
In June, KPMG, the auditing firm enlisted by the Independent Electoral and Boundaries Commission, recommended that more than 92,000 dead voters be removed from the registration rolls.
Before his death, the election official, Christopher Msando, reassured the public that the collection and tallying of votes was watertight. The commission, he said, had invested in satellite technology in case phone networks failed, as well as backups. It even ordered, for each of the country’s 40,883 polling stations, more technology kits than necessary to identify voters and transmit the results.
There are other reasons for optimism. “A lot of work has gone into institutions, at the grass-roots level,” said Marietje Schaake, who leads the European Union’s Election Observation Mission. “You have a new Constitution, and that has put in place checks and balances. These are the kind of steps that have been meaningful compared to even five years ago.”
Candidates who are not affiliated with any party or driven by ethnic interests have also started to emerge.
Boniface Mwangi, 34, a photojournalist and activist who gained prominence for his work documenting electoral violence a decade ago, formed a party and has become popular on social media sites. He is the leading candidate for a seat in Parliament representing Starehe, a constituency in Nairobi.
Mr. Mwangi said voting habits were starting to change, especially among young people, who make up more than half the electorate and who, he said, “are tired of party and tribal politics.” He said that by the next election, in 2022, he expected the dominance of the two political families to have diminished.
Kenyans, he said, are beginning to pay more attention to economic issues than to ethnic and party loyalties. “When they get even more broke they will start to look at actual ideas,” he said.
Mr. Mwangi said that a decade ago, when he traveled around Kenya taking photographs of the violence, he was struck by haunting images of “the poor killing the poor.”
“The poor should be smarter,” he said. “They shouldn’t die for Boniface Mwangi. They shouldn’t die for Raila Odinga. They shouldn’t die for Uhuru Kenyatta.”