The Soviet Union today condemned President Carter's failed Iranian rescue mission as bordering on madness and said it could bring war to the Persian Gulf, "mass bloodshed and the deaths of the hostages."

In late afternoon, Tass said that "what is taking place, in fact, is a balancing on the brink of madness, and there is no need to say what a serious danger is posed to peace."

The official Tass news agency, in scathing attacks through the day, declared that "the abortive provocation in Iran showed once more that the present master of the White House could not care less about his fellow citizens and is prepared to sacrifice their lives for his election interests."

In late afternoon, Tass said that "what is taking place, in fact, is a balancing on the brink of madness, and there is no need to say what a serious danger is posed to peace."

The failed rescue has offered the Soviet Union an opportunity to bolster their efforts to deflect world attention from their military intervention in Afghanistan and their continuing campaign to drive wedges between the United States and its Atlantic allies.

"The latest reckless actions of the U.S., undertaken in Iran without consultation with the allies and without their knowledge, speaks of the determination of the American administration to continue to aggravate the explosive situation in the region," Tass said. "The responsibility for these actions of President Carter is also shared by the American administration and those who support it."

In Paris, Soviet Foreign Minister Andrei Gromyko condemned the U.S. military operation and said a "peaceful solution . . . is the way along which the United States should travel" to resolve the Iranian crisis, Washington Post correspondent Ronald Koven reported.

"[We resolutely oppose all military efforts against Iran by the United States or anyone else," he said at a news conference, and dismissed as "hypothetical" a question about whether the Soviet Union would aid Iran against any future military move.]

Moscow is rapidly improving its position of influence in Tehran after months of strained relations with Ayatollah Ruhollah Khomeini, who has denounced the Soviet intervention in neighboring Afghanistan. The Soviets recently signed a trade pact with Iran aimed at blunting the effects of American economic sanctions.

In reports tonight, Tass played on the theme that Iran may be surrounded by other enemies, such as Egypt, or possibly Turkey, where it said U.S. planes may have been based or refueled prior to the rescue attempt. sThese countries must be considered "accomplices" in an act of international piracy," Tass said.

In November 1978, Soviet President Leonid Brezhnev warned the United States and other Western powers that any military effort to shore up the shah of Iran would be considered "a matter affecting the security interests" of the Soviet Union. This warning was most recently reiterated March 25 in a Tass dispatch denouncing the presence of U.S. naval forces in the Persian Gulf area. But the Soviet warnings were blunted some months ago when Khomeini abrogated the two military assistance clauses of a 1921 Soviet-Iranian friendship treaty.

It is felt here now that the Soviets will use the rescue attempt for new attempts to restore some form of military assistance pledge between the two countries.

With increasing stridency beginning last fall, Moscow has painted Carter as a warmonger, blaming him for forcing new strategic missiles on NATO, increasing U.S. arms spending, stalling SALT-II ratification, and plotting anti-Soviet moves with China.

In the aftermath of its December Afghanistan intervention, Moscow was expected to undertake a series of diplomatic initiatives soon aimed at pressuring the West Europeans over the developing Olympic boycott, the NATO missile decision, and other issues at the expense of the Carter White House.

Tass picked up the theme of Carter as a dictatorial ally, declaring the rescue operation showed "Washington not only failed to consult its NATO allies; but deliberately concealed from them the piratic concept of an air attack on Iran. However, the leaders of West European countries will not be able to keep silent indefinitely. They will have to determine their position."

The direct military attempt to save the hostages may also aid Moscow in its efforts to make headway with Moslem-dominated Third World countries, which almost unanimously condemned the Soviet military operation in Afghanistan. Tass said the rescue effort shows that the United States only "poses as a friend of Moslem peoples."

News services reported these reactions from other countries:

Romania -- Often out of step with its Eastern European allies, Romania said of the U.S. action that the violation of a country's national sovereignty cannot be considered a "humanitarian act," as it was described in a statement by President Carter. The official news agency Agerpres condemned Iran's taking diplomats as hostages but said this did not justify infringement of a country's territorial sovereignty.

Bulgaria -- The official Bulgarian news agency BTA said the hostage issue could have been solved long ago by negotiations and was only a pretext for U.S. plans to regain a dominant position in Iran.

Czechoslovakia -- Radio Prague said the U.S. military action on Iranian territory "could have created an exceptionally serious situation."

India -- Indira Gandhi's government criticized the bungled American attempt to rescue the hostages as "military adventurism," but urged caution and restraint on both sides in its aftermath. A spokesman said India hoped the United States and Iran would "respect the imperative need for peaceful negotiation." He said the U.S. action "could have large-scale and longterm negative implications for stability and peace in the West Asia region."