Hundreds of foreign nationals, including at least 34 American, were stranded in Iraq today, unable to obtain exit permits, according to diplomatic sources and some of the travelers pouring through here overland from Baghdad.

U.S. officials said the Americans unable to leave Iraq include nine dependents of employes in the U.S. special interest section in Baghdad. The United States does not have diplomatic ties with Iraq and the interest section of the Belgian Embassy was opened in 195. Iraq broke relations following the 1967 Middle East war.

U.S. officials in Baghdad have advised Americans still in Iraq not to attempt to leave without the required exit permit from the Iraqi government, and to travel overland to Amman only in motor convoys. About 200 to 300 U.S. citizens remain in Iraq, officals said.

"The fact that there are no diplomatic realtions makes it more difficult for us," a U.S. Embassy official said.

Hotels here were spilling over with foreigners fleeing Iraq, most of whom had traveled 15 to 24 hours by bus through the western Iraqi desert to reach the Jordanian border, which is another four hours' drive from here.

A large ballroom in the Intercontinental Hotel has been turned into a temporary shelter, primarily for Swedish nationals, including diplomats and stranded businessmen. About 60 British nationals were headquartered in a nearby hotel, while West German visitors and residents of Iraq were housed in a German school here.

Heikke Nilend, a Swedish architect who was trapped in Baghdad while designing a new government hospital, said the Iraqis attempted to minimize the air attacks there, although Iranian warplanes were clearly visible from the center of town.

"There was lots of propaganda and nationalist music, but no panic. They never talk to the Europeans too much, but they did try to minimize the danger to us. We simply went to the [Swedish] embassy and 24 hours later were evacuated," Nilend said, adding that he had obtained an exit visa upon arriving in Baghdad.

A charter plane from Stockholm was due here tonight to take the Swedish travelers out of Jordan.