A top Nicaraguan official charged today that the United States imposed economic sanctions against the Sandinista government as a substitute for its failed military policy. Top Sandinista leaders went into emergency session tonight to consider what steps might be necessary to offset the measures.

Vice President Sergio Ramirez said that President Reagan, by announcing the economic embargo against Nicaragua, was acting as if the nations were formally at war.

"All the measures that the United States is taking against Nicaragua are the measures one country usually takes against a country with which it is at war," said Ramirez. "And we are not officially at war with the United States."

As the government adopted a stance of strident defiance against the U.S. measures, representatives of the country's small but important private sector were divided on the impact. Some expressed fears that they no longer would be able to operate without items normally received from the United States, while others said they could cope.

The atmosphere of political tension in Managua raised by the sanctions was heightened by an unrelated confrontation at midday between several hundred antigovernment labor unionists and a phalanx of rifle-bearing police.

The incident began when the union members left a mass conducted by Archbishop Miguel Obando y Bravo and began a march. They were soon confronted by the police and a melee, including rock throwing, began. No serious injuries were reported by journalists who witnessed the incident but it represented a rare large-scale antigovernment demonstration in the capital.

Meanwhile, Ramirez, in a news conference and interview, was giving the Sandinistas' response to the U.S. sanctions.

"The measures announced by the government of the United States are measures that show the will of the present administration to destroy the revolution of Nicaragua," he said.

They "are pure retaliation against the people and the government of Nicaragua because of the impossibility that the government of the United States has seen in destroying the Sandinista revolution through military means," said the leader.

Ramirez added that the embargo also reflected the "impotence" of President Reagan because of his "political defeats in the United States Congress," an apparent reference to last week's congressional vote that denied the president $14 million in funds he had sought for U.S.-allied rebels.

Ramirez said that the Sandinista directorate, without President Daniel Ortega, who is in Eastern Europe after a visit to Moscow, was considering a variety of measures in response to the U.S. embargo.

Ramirez said the sanctions would affect the Nicaraguan economy "gravely. Not just the Sandinista front as a party, and not just the government, but all the country." Ramirez said his government will protest the Reagan administration's decision in international forums and look for support to try to offset the U.S. decision.

"We by no means feel alone," he said. "All countries that love peace and independence and self-determination and who have been interested in peaceful solutions to the conflicts of Central America will respond with political and economic help for Nicaragua."

Ramirez emphasized that 60 percent of the Nicaraguan economy is still in private hands and that private entrepreneurs also would be damaged by the Reagan administration's decision.

Although many businessmen oppose the Sandinistas and say in private that they favor the Reagan administration's policy of supporting anti-Sandinista rebels, there were voices here both supporting and condemning the decision to embargo trade.

"This is a Marxist-Leninist government, and every dollar that they get is a breath of oxygen to them. What has to be done is that the oxygen has to be cut off," said one businessman who favored the embargo but asked not to be identified. But another disagreed.

"This is what the United States tried to do to Cuba. It didn't do any good," said Alfredo Montealegre, president of the Nicaraguan Chamber of Industries and an outspoken opponent of the government.

"All it did was give Castro excuses for everything he did in Cuba. That's what will happen here with the Sandinistas," said Montealegre. "This will give them the excuse to repress the private sector, to get rid of us."

Although he said he opposed the Reagan move, Montealegre said he still considered the events the fault of the Sandinista government, which he said had been "intransigent" in the face of U.S. demands to make democratic reforms.

Another businessman, contractor Gilberto Cuadra, said, "What I see is that this is all the flowering of the East-West conflict, and we are the ones being caught in the middle of it."

Today's confrontation occurred after Archbishop Obando y Bravo, who will be raised to the rank of cardinal May 25 and is an outspoken critic of the government, had said mass at the El Calvario Church in Managua's Eastern Market. The market is a sprawling warren of stalls for independent vendors and has been a focal point of opposition to the Sandinista government.

Journalists said after the mass was over and the archbishop had left, several hundred members of two anti-Sandinista labor organizations, the Confederation of Unified Labor and the Nicaraguan Workers' Central, began to march from the church. They were stopped by about three dozen policemen blocking the road arm in arm, the reporters said.

Shouting and pushing began, and then the police, with arms interlocked, forced the marchers back toward the church.

According to the journalists, members of the crowd then began to throw sticks and rocks at the police and when some police tried to enter the crowd, apparently to detain those throwing rocks, many of the demonstrators ran back into the church and someone began to toll the bells.

The reporters also said that a group of some Sandinista supporters began to throw stones at the protesters.

The police did not enter the church, the journalists said, adding that they did not see anyone detained or seriously injured.