As thousands of Iranians shouted anit-American slogans at a festive demonstration in the occupied U.S. Embassy in Tehran, Iran demanded yesterday that the United States respond swiftly and publicly to its conditions for release of the hostages entering their second year of captivity.

Prime Minister Mohammed Ali Rajai, addressing a throng of 20,000 inside the 27-acre embassy compound exactly one year after its seizure, said his government will take control of the 52 hostages pending the outcome of the indirect negotiations under way between Washington and Tehran for their release.

"The government, according to the responsibility handed to it by parliament and the iman [Ayatollah Ruhollah Khomeini], will take the hostages from the brothers and sisters resident in the nest of spies," he said, using Khomeini's derisive nickname for the U.S. Embassy.

Turnover of the hostages by Islamic students who seized the embassy Nov. 4, 1979, and have held the Americans ever since would mark an important gauge of good faith for Iran's willingness to free the captives. Rajai did not say when the hostages would actually change hands, and Reuter reported from Tehran that a student spokesman refused comment on his declaration. But the students announced Monday that they are prepared to relinquish control over their captives in accordance with the wishes of Khomeini.

The demand for a public U.S. response "to the people of the world," relayed over Tehran radio, appeared to raise potential new difficulties and underlined once again the unorthodox diplomacy practiced by Iran's Islamic revolutionary leadership. The U.S. State Department immediately rejected the idea of a public exchange and emphasized instead that it is giving careful but secret scrutiny to an official list of conditions received Monday from Iran. [Details on Page A5.]

Ali Reza Nobari, the Iranian Central Bank governor, said in a telephone interview, meanwhile, that as part of a hostage release deal Iran would accept an international commission to rule on claims against it by American banks and companies and is prepared to set up "an escrow account" to cover any judgments. [Details on Page A3.]

Far from the hostage drama between Tehran and Washington, but casting its shadow over it, the Iranian-Iraqi war ground on around the disputed Shatt-al-Arab waterway. In Baghdad, President Saddam Hussein of Iraq told his nation's National Assembly that he is prepared for a long war unless Iraqi "national rights" are recognized and warned Iran that the fighting could create new demands beyond those for which Iraq originally went to war last September. [Details on Page A6.]

The embassy crowd, the first allowed inside the compound since it was taken over, mixed slogans vilifying Hussein and the Iraqis with equally vehement solgans against President Carter and the United States. At this point, Iranians burned the U.S. flag and a papier-mache effigy of Carter, recalling the weeks shortly after the embassy capture when such displays were filmed almost daily by U.S. television cameras in streets outside the walled compound.

"Death to Saddam, death to America," they shouted, according to wire service accounts from Tehran. "No surrender, but fight with America. Carter, Carter, shame on you. Saddam, Saddam, death to you."

Western reporters in Tehran noted, however, that the mood of the crowd was relaxed. Revolutionary Guards brandished assault rifles with flowers stuck in the barrels, and children played on the embassy grounds as if it were a public park, they said.

The compound walls were plastered with pictures showing important episodes in the year since the embassy was taken over and the American's inside were taken captive. It was as if, in the words of a witness cited by Reuter, "It's all history. The drama is over."

None of the demonstrators was seen actually entering the embassy buildings. According to recent assessments in Washington, most of the hostages probably are in the embassy or at another gathering point in Tehran.

The student militant holding them claimed after an abortive U.S. rescue attempt last April 25 that the captives were scattered around Iran to make any further rescue tries impossible. But since then they have returned their prisoners to Tehran, according to these reports, presumably in preparation for a release.

As far as is known, three of the hostages have been held in the Iranian Foreign Ministry throughout the year and are still there.

The ministry announced yesterday it has messaged the Carter administration through the Algerian Embassy in Washington to demand a speedy reply to the conditions set Sunday by the Iranian parliament, or Majlis. In general, these include a pledge of noninterference in Iranian affairs, the unfreezing of Iranian assets in U.S. financial institutions, return of the late shah's wealth and the dropping legal claims against Iran by U.S. companies and banks.

A U.S. communication, delivered Monday by the Swiss ambassador in Tehran, contained "some provisions . . which are contrary" to the conditions, the ministry said in a statement carried by the official Iranian news agency, Pars. The State Department said in Wasington that only the text of Carter's televised statement Sunday has been relayed to Tehran, leaving the impression that the ministry's comment referred to this. Rajai, in a statement carried by the official radio, also referred to Carter's message, "in which he commended generally on the issue."

Rajai, interviewed on Tehran radio after the embassy demonstration, was asked if he thought the United States is ready to reply to Iran's demands. He replied: "If, according to what the U.S. has claimed, it wants to solve the question, it will be obliged to give a positive answer to us. Otherwise, for us nothing will change."

But Hojatoleslam Ahmed Khomeini, son of the revolution's 80-year-old patriarch, insisted that so far no solution is in sight, apparently trying to dampen speculation in Tehran and the United States that the hostages will be freed within a few days now that the Majlis has acted.

In Moscow, the official Soviet news agency Tass declared that Washington will be unable to meet two of the Majlis' conditions. These, it said, are the return of the shah's wealth and the restoration of frozen Iranian assets -- impossible to meet because the money has been squirreled away by American banks.

"Having recourse to various subterfuges, American banks began spending the Iranian assets to repay ahead of schedule any loans, which Iran has never recieved," the official agency said. "Billions of dollars have been plundered, which the banks will hardly agree to pay."