United States officials here believe they have temporarily stopped a rightist coup in El Salvador by threatening to cut off all military, economic and political support for such an action.

The situation here remains tense, however, in the wake of attacks on leftist and centrist members of the U.S.-supported coalition government by ultrarightist terrorists.

"The people of this country and part of the key actors involved have the good sense to avert a coup that by all indicators was set to take place this weekend," said one highly placed U.S. official here.

"As we became aware of this (coup plot) last week," the official said, "the United States moved very quickly and very forcefully to make unequivocally clear its opposition to such a coup and to reiterate its support for the current junta and reform program."

The plot to oust the month-and-a-half old coalition between Christian Democrats and the military men who seized power from the repressive government of Gen. Carlos Humberto Romero in October included plans for shutting down all communications in the country for at least one day as the rightists consolidated their power over the nation.

Such a move, U.S. officials fear, would result either in ruthless oppression and bloodshed on the order of that perpetrated by the Chilean military after the coup overthrowing Salvador Allende or all-out civil war which could eventually be won by Marxist guerrillas.

Neither of these alternatives would be acceptable to the United States, officials here have said. The U.S. diplomats, as well as more liberal members of the El Salvador military, maintain that the promise of $50 million in U.S. economic aid and about $5 to $10 million in military support were vital factors in averting the coup.

Under the Romero government, El Salvador saw the United States cut off all but about $5 million a year in economic aid and sever military support entirely.