The idea is to challenge China’s infrastructure program while also pushing back against its trade practices, cybertheft and expanding military facilities and presence in the Pacific and Indian Oceans. But the threat posed by the Belt and Road Initiative to American interests is debatable, and it is unclear how far the United States should — or can — go to compete. The funds set aside by the Trump administration amount to just a fraction of Beijing’s commitment.

In Africa, American businesses have been largely absent while Chinese companies have put down roots, nurturing powerful allies through both legitimate and illegal means. Some target individual African officials and their family members with cash bribes or deals for services, like legal representation or insurance.

Ms. Jandhyala’s bid for the $4 billion refinery project was a case study in the long odds the United States faces as it tries to go head-to-head against China in infrastructure development — and in the conditions under which American companies could prevail.

The competition came to a head early last year, when Ms. Jandhyala and other consortium executives faced off in a conference room above Lake Victoria against Ugandan officials backing the Chinese companies. Uganda’s strongman president for the past 33 years, Yoweri Museveni, had called the meeting in his compound to try to resolve the bitter dispute.

In a sign of the intense infighting, Uganda’s domestic intelligence agency investigated three officials believed to favor the American consortium and questioned its ability to finance the project, according to a copy of the agency’s report reviewed by The New York Times.

In an April speech, Mr. Museveni praised Western companies for finally “waking up” to Africa. But he also noted that “the Chinese have already woken up — they are really, really, really very active and fast.”

“So why not take advantage of both?” he asked.

Scramble for a Prize

The African Great Lakes have long tempted outsiders seeking riches, including the European nations that began plundering the continent in the 19th century. But in 2006, four decades after the end of British rule in Uganda, a prize untapped by the colonialists was discovered: oil deposits by Lake Albert that are among the largest in East Africa, enough to transform parts of impoverished Uganda.