The Carter administration, saying its first concern is to ensure that American hostages released by Iran get out of the country safely, yesterday imposed an almost total blackout on official statements and information about the situation there.

The decision was made in the face of apparently unexpected developments that added new layers of confusion and tension to the two-week-old tug of war over the approximately 70 hostages, including 62 American, being held at the U.S. Embassy in Tehran.

These developments included ominous warnings by Iran's de facto ruler, Ayatollah Ruhollah Khomeini, that some of the hostages might be tried as spies if the Unites States does not accede to Iranian demands for the forced return of deposed Shah Mohammad Reza Pahlavi, who is being treated for cancer in a New York hospital.

Khomeini had ordered Saturday that all blacks and women among the hostages be released. Early this morning, Tehran time, the Iranian militants holding the embasssy released three captives -- one woman and two black men who had been allowed to speak to news media yesterday -- and indicated that 10 hostages would be released later.

But the remaining captives apparently will include two women and two black men. It was unclear if those hostages fell into the "spy" category Khomeini has excluded from release.

Despite the almost total silence the administration imposed on itself, a senior official said last night that the United States would consider the trying of its diplomates on espionage charges to be "a further violation of international law" by Iran.

The official suggested no weakening in the U.S. policy of refusing to turn over the exiled shah to Iranian authorities, and repeated President Carter's warning of last week that the Iranian authorities will be half accountable for the safety of the American hostages.

Espionage trials for American diplomats, the official added, almost certainly would increase the concern being expressed by other nations, all of which have diplomatic communities stationed around the world.

State Department spokesman Hodding Carter said the U.S. government has "no independent confirmation" of Khomeini's warning about such trials, which came in interviews with American television reporters.

The State Department spokesman, who made his comments before the hostages were released, said he had "no reason to disbelieve" reports that they would be freed, but U.S. officials said that the clamp on information would remain until the situation became clearer.

The first three hostages to leave Iran flew to Copenhagen. Hodding Carter said yesterday that preparations had been made at several locations for taking care of released hostages, and he added that initially they would be isolated from the press.

"Our first concern will be for their physical health," he said. "We are going to give them some decompression time where they will not have to face bright lights and microphones until they have had a chance to recover from their experience."

With the administration waiting and keeping silent, it was not possible to piece together a picture of how the latest Iranian moves might affect hopes for resolving the crisis that began when students took over the U.S. Embassy Nov. 4.

Iran's announcement Saturday that some hostages would be freed has raised cautious hopes that the U.S. stragedy of firmness and patience was nudging Iran toward some sort of compromise. But Khomeini's statements yesterday, if taken at face value, appeared to indicate a new instransigence that could force the Carter administration to seek tougher counter steps.

One hint that President Carter might soon have to confront rising domestic impatience with his tactics came from Republican presidential hopeful John B. Connally, who said it was unfair for Carter to ask other candidates to remain silent while he makes "ringing speeches" about his handling of the situation.

Connally, interviewed on "Issues and Answers" (ABC, WJLA), cited Carter's speech about Iran last week before the AFL-CIO convention and siad:

"The president has not been quite fair . . . He has asked us to remain silent while he takes that period of silence as an opportunity to go before a convention and use inflammatory language himself, which he asked us not to do."

Except for Connally, though, there were no immediate indications that other presidential hopefuls are moving away from the supportive stance they have given Carter so far. Sen. Edward M. Kennedy (D.Mass), interviewed yesterday on "Meet the Press" (NBC, WRC), repeated his support for Carter's actions and called on Americans to follow the president's leadership in Iranian crisis.

Further confusing the situation was a report yesterday in the Mexico City newspaper Excelsior that the shah would return today to the Mexican resort of Cuernavaca, where he had been living before going to New York last month for cancer treatment. Although there have been persistent hints that the shah would leave the United States, there was no immediete confimation of the Excelsior report.

Also yesterday, the Library of Congress released a study saying that Iran must increase rather than cut its oil production to generate enough earnings to meet expectations of its people and tamp down rising domestic discontent.

The study, prepared by Theodore Moran of Georgetwon University, said Iran's stated goal of reducing production to a range between 2.5 million and 3.5 million barrels a day barely would produce the funds needed for a drastically reduced national budget.