BERLIN—The head of the United Nations atomic watchdog agency left Iran late Tuesday after failing to reach a deal to allow inspectors access to a factory making equipment for Tehran’s nuclear program, diplomats said Wednesday, casting a fresh shadow over international nuclear talks set for next week.

The Wall Street Journal reported last week that the factory, in Karaj, Iran, had resumed producing key parts for centrifuges, which are used to enrich uranium, without any monitoring by the International Atomic Energy Agency....

BERLIN—The head of the United Nations atomic watchdog agency left Iran late Tuesday after failing to reach a deal to allow inspectors access to a factory making equipment for Tehran’s nuclear program, diplomats said Wednesday, casting a fresh shadow over international nuclear talks set for next week.

The Wall Street Journal reported last week that the factory, in Karaj, Iran, had resumed producing key parts for centrifuges, which are used to enrich uranium, without any monitoring by the International Atomic Energy Agency. The diplomats said talks between the IAEA and Iran were continuing.

With Iran, the U.S. and other major powers set to resume negotiations in Vienna next Monday aimed at curbing Iran’s nuclear capabilities, that raised new concerns among Western officials that Iran could divert nuclear equipment to a possible future covert nuclear weapons program.

Iran says its nuclear program is purely peaceful. Western officials have said there is no evidence Iran is currently building a covert nuclear weapons program.

“We could not agree yesterday in spite of my best efforts,” IAEA Director-General Rafael Grossi told reporters, adding that the agency needs to “restore the monitoring and verification capacities” at the site.

Mr. Grossi said talks to reach an agreement on Karaj were continuing but they didn’t appear to be close to a deal.

However, he warned that without IAEA access to the site, he would soon be unable to give future assurances about material produced at Karaj. Neither the IAEA nor Iran has confirmed that Karaj has resumed production since June.

Western officials have said that without certainty about Iran’s existing nuclear infrastructure it will be much harder to seal a deal in which the U.S. and Iran each commit to certain steps to return to compliance with the 2015 deal.

Iran hasn’t given the IAEA access to Karaj since the site was subject to what Iran claims was an attack by Israel in June. Israel has neither confirmed nor denied the charge. Iran removed IAEA cameras from the site after the attack.

In September, Iran agreed to provide access to IAEA inspectors to all nuclear-related sites where cameras and other recording devices needed to be reset or restored. However, it then denied agency inspectors access to Karaj. Iran says the site wasn’t part of the access agreement, a claim denied by Mr. Grossi.

Two diplomats said Iran declined to offer the agency access to Karaj unless Mr. Grossi dropped parts of a continuing IAEA probe into the discovery of undisclosed nuclear material in Iran over the past two years. Mr. Grossi declined.

Mr. Grossi didn’t comment on Wednesday when asked about that issue.

Mr. Grossi also reported on Wednesday to a meeting of the IAEA board of governors that his discussions in Tehran with Iran’s foreign minister and its nuclear agency chief on the agency’s nuclear material probe and Iran’s use of “excessively invasive physical searches” of inspectors had made little progress.

“Despite my best efforts, these extensive negotiations and deliberations to address Iran’s outstanding safeguards issues…proved inconclusive,” he said.

While Iran says it isn’t trying to build nuclear weapons, a look at its key facilities suggests it could develop the technology to make them. WSJ breaks down Tehran’s capabilities as it hits new milestones in uranium enrichment and limits access to inspectors. Photo illustration: George Downs The Wall Street Journal Interactive Edition

Tensions between Iran and the IAEA have been growing for the last two years, as Iran has expanded its nuclear work and repeatedly failed to clear up agency questions about several traces of radioactive material found in samples in the country. Iranian officials have repeatedly accused the agency of politicizing its work.

The U.S., France, Britain and Germany have several times this year discussed whether to introduce a motion of censure of Iran at the IAEA board, something that could in theory lead to U.N. Security Council action against Iran. But they have backed away for fear it could scuttle the talks on restoring the 2015 agreement.

One of the Biden administration’s top foreign-policy goals is reviving the 2015 nuclear deal between Iran and six major powers which placed strict, but temporary, restrictions on Iran’s nuclear activities in exchange for lifting most international sanctions.

However, U.S. officials have warned that time is running out to be able to rebuild the nuclear deal because of Iran’s ongoing nuclear activities. Iran has gradually breached most of the limits in the 2015 deal since former President Donald Trump took the U.S. out of the agreement in May 2018.

Write to Laurence Norman at laurence.norman@wsj.com