Antigovernment rebels staged one of their largest raids ever today, causing heavy damage to Sandinista installations in this town on Central America's major highway. Today's raid, which followed damaging attacks in this area over the past several days, led to a state of alert in the nearby important northern city of Esteli.

A top Sandinista official in Esteli called the recent rebel action "the most serious we have seen around here" since fighting began in 1982, but he insisted that there was no danger of that city's being taken by the rebels.

On Sunday, 29 government troops were killed in an ambush three miles outside Esteli. On Monday and Tuesday, the rebels, also known as contras or counterrevolutionaries, placed explosive charges that partially damaged two bridges on the Pan-American Highway.

"The contras had this town for several hours this morning," said Gladys Mairena, 42, a La Trinidad shop owner who said the contras forced their way into her home thinking it was that of a Sandinista official.

"Apparently they were looking for him to kill him and they made a mistake," she said. She added that the contras left without harming anyone, but did fire bursts of automatic weapon fire into her wall.

At the Air Force base in Esteli, light planes and Soviet-made MiG24 helicopter gunships started taking off shortly after dawn. It was believed to be the first time the Sandinistas have used in combat the sophisticated helicopters that came into the country last November.

Residents of La Trinidad, who estimated that the population of their town is about 8,000, said the rebels swarmed over the hills around the town at dawn, quickly taking a bridge leading to Esteli farther north. The rebels then engaged in at least a three-hour battle in and around La Trinidad with local Sandinista militiamen and later with Sandinisita Army reinformements.

La Trinidad is about 85 miles from Managua, and Esteli is about 100 miles from the capital.

Militiamen said the rebels took the park in the center of the town and from there opened fire on the adjacent militia headquarters, eventually killing or driving out all its defenders and capturing it. The building was riddled inside and out with bullet holes, and in the roof there were large holes, which, according to militiamen interviewed later, were caused by rebel rockets. Three militiamen reportedly died there. The police headquarters also was heavily damaged.

Residents said the rebels closed the highway right after dawn and with rocketfire hit a car carrying Sandinista internal security officials, killing three men. Later, the Sandinistas kept the road closed, advising travelers that there was fighting close to the highway.

Trailer trucks, headed for other Central American countries on the region's major thoroughfare, were backed up in both directions this afternoon.

The rebels also set fire to state grain silos and the large storage shed containing corn and beans grown in the fields near La Trinidad. Nicaraguan soldiers were extinguishing the last flames around noon and said they had saved most of the grain.

Throughout the morning, Esteli residents heard loud explosions from the direction of La Trinidad to the south and also to the east, where Sandinista troops have been pursuing rebels since the ambush Sunday. Army spokesmen Lt. Alberto Valdez said the Sandinistas were using heavy artillery, aerial bombing and the helicopter gunships against the contras.

Radio Liberacion, a government radio station in Esteli, was asking former Sandinista combatants who had fought in the revolution that brought the Sandinistas to power in 1979 to report to military authorities for possible duty.

More troops were sent to military outposts on the hills around the city, and teachers were told to practice evacuation and bomb shelter drills in schools.

Government and military officials monopolized telephone lines to Managua, and gasoline could not be purchased without a government order.

Despite these measures, residents were going to work, and life appeared relatively normal in Esteli, a city of about 50,000 residents which was heavily bombed by the planes of dictator Anastasio Somoza during the revolution and reportedly lost about 10 percent of its population during that war. Esteli is considered a Sandinista stronghold.

"Our people have seen a lot and they don't get scared very easily," said the Sandinista official who asked not to be named. "Yes, we are on a state of alert, but we are not afraid of them taking this city. We are very strong here, and it is one of the last places they could think of capturing."

The raid on La Trinidad is the largest single rebel raid on a town in over a year. In June 1984, the rebels entered Ocotal, the capital of Nueva Segovia province, destroying various government installations, and in October 1983 the rebels killed 47 Sandinistas in the town of Pantasma, in Jinotega Province.

The Army said fighting was continuing late this afternoon, but farther away from the highway.

Reuter reported the following from Managua:

The Nicaraguan Defense Ministry said its armed forces had been placed on maximum alert after a U.S. aircraft carrier was detected off the country's Atlantic Coast.

A ministry statement said the carrier USS Eisenhower, equipped with at least 80 aircraft, was stationed yesterday near the San Andres Islands, about 235 miles southeast of the Atlantic port of Puerto Cabezas.

It added that five other warships were headed for the area from the Panama Canal late Wednesday.