WASHINGTON — Before Saudi Arabia’s crown prince, Mohammed bin Salman, was implicated by the C.I.A. in the killing of Jamal Khashoggi, American intelligence agencies were trying to solve a separate mystery: Was the prince laying the groundwork for building an atomic bomb?

The 33-year-old heir to the Saudi throne had been overseeing a negotiation with the Energy Department and the State Department to get the United States to sell designs for nuclear power plants to the kingdom. The deal was worth upward of $80 billion, depending on how many plants Saudi Arabia decided to build.

But there is a hitch: Saudi Arabia insists on producing its own nuclear fuel, even though it could buy it more cheaply abroad, according to American and Saudi officials familiar with the negotiations. That raised concerns in Washington that the Saudis could divert their fuel into a covert weapons project — exactly what the United States and its allies feared Iran was doing before it reached the 2015 nuclear accord, which President Trump has since abandoned.

Prince Mohammed set off alarms when he declared earlier this year, in the midst of the negotiation, that if Iran, Saudi Arabia’s fiercest rival, “developed a nuclear bomb, we will follow suit as soon as possible.” His negotiators stirred more worries by telling the Trump administration that Saudi Arabia would refuse to sign an agreement that would allow United Nations inspectors to look anywhere in the country for signs that the Saudis might be working on a bomb, American officials said.