The nationwide military alert announced yesterday was aimed primarily at preparing Nicaragua for an "eventual" U.S. attack rather than an imminent one, Defense Minister Humberto Ortega said today.

Without ruling out "a surprise attack," Ortega described the mobilization as a dress rehearsal for how to react in case of U.S. air strikes or a full-scale invasion, "if one happens." His comments at a news conference here suggested that the government was backing off from warnings during the past week that the United States might be about to move against the leftist government here.

Another senior official, junta member and Vice President-elect Sergio Ramirez, warned that a "crisis" could result the next time a Soviet or Bulgarian ship delivers weapons to Nicaragua. But he and Ortega said Nicaragua would continue to import arms from Soviet Bloc countries as long as it is battling antigovernment rebels, and as long as the United States is "threatening" it and violating its airspace and territorial waters.

Following the military alert, which Ortega said was only one step below full mobilization, tanks and armored personnel carriers were stationed in Managua's streets for the first time since the Sandinista National Liberation Front came to power five years ago. The government acted after the United States stepped up warnings about delivery of Soviet Bloc arms here, and after U.S. supersonic spy flights caused sonic booms over the capital and other towns daily from Thursday through Sunday.

The Sandinistas' concerns may have been calmed by the fact that U.S. officials backed down over the weekend from statements that there might have been supersonic Mig warplanes aboard a Soviet ship that docked last week at the port of Corinto. Earlier, the administration had said it suspected the ship was delivering Migs. U.S. officials have suggested that if Nicaragua obtained Migs the planes would be bombed.

No sonic booms were heard here today or yesterday. The spy flights may have stopped because the Soviet ship whose arrival triggered the controversy left Nicaragua yesterday. That ship, the Bakuriani, delivered two sophisticated Mi24 helicopter gunships, according to a senior government official.

The main practical goal of the alert appeared to have been to step up training of militias and civilian activists in civil defense tasks. Militias and civil defense organizations were actively recruiting new members in the first such mobilization in a year. Last November, when the Sandinistas warned that the United States might follow up its invasion of Grenada in October with an attack on Nicaragua.

"The immediate objective of the alert is to fortify the general readiness of our people and of the armed forces for an eventual direct U.S. intervention," Ortega said. "In the current military and political context, we cannot afford the luxury of not taking these measures."

Another purpose of the alert, Ortega said, was to demonstrate to the United States that a military intervention against Nicaragua would be "a mistake" because the country is prepared to fight. He said the alert would last "until the Reagan administration lowers the pressure that it currently is maintaining against our country."

Ortega said Nicaragua intended to seek arms "to defend our territorial integrity against U.S. spy flights or naval incursions."

Asked whether Nicaragua intended to try to shoot down U.S. reconnaissance aircraft, Ortega first hinted that it would, but then backed off.

Ortega left open the possibility that Nicaragua would obtain advanced warplanes. Diplomats here from several countries have said they do not expect that the Sandinistas would obtain Migs any time soon because of the obvious danger of provoking a U.S. military reaction.

The United States has complained that Nicaragua recently has beefed up some classes of its weaponry, and a senior Nicaraguan official confirmed that the country in the past few weeks has received between four and six Mi24 helicopter gunships.

Junta member Ramirez expressed concern that the alarm in Washington last week over deliveries of Soviet Bloc weaponry meant that tensions would worsen with the next shipment.

"The next time that a Soviet or Bulgarian ship arrives carrying arms . . . evidently, there will be a crisis," Ramirez said.

Noting reports in the United States that Washington was considering harassing or even blockading ships carrying arms to Nicaragua, Ramirez suggested that an incident might involve the Soviet Union as well as Nicaragua in a confrontation with the United States. But, he said, "We have not talked of consequences" with the Soviets, and added: "I don't expect that the Warsaw Pact is going to come defend us if we're invaded by the United States."

Ramirez said that senior government officials stayed up until 3 a.m. Nov. 7 -- following Election Day in the United States -- because of their concern over reports from Washington suggesting that warplanes were about to arrive here. He said they drafted the government communique issued later in the day denying that any warplanes were on the way.