A month ago, the San Vicente Hospital here, a Spanish-style structure with a pleasant courtyard at its center, was the scene of one of the cruelest battles of Nicaragua's bloody civil war.

Deposed president Anastasio Somoza's National Guard had occupied Matagalpa's only medical facility and prohibited the city's few doctors from entering. Several patients, too ill to be moved or to escape, died.

Their bodies were found, after the war ended three weeks ago, in the partially destroyed hospital.

According to Dr. Cerefino Padilla, who serves as director of San Vicente, some of them were shot by National Guard troops who occupied the facility or by Sandinista guerrillas, who stormed it for two weeks before they finally took it from the Somoza forces.

Other patients died of hunger or lack of medical care, Padilla said.

Even after San Vicente was captured by the Sandinistas, three National Guard soldiers, armed with mortars, held out on the Hill of the Virgin overlooking the hospital. Survivors says mortar rounds slammed into San Vicente for several days after Somoza fled Managua and his cause obviously was lost.

Now a team of 32 Cuban doctors, nurses and medical technicians, sent by President Fidel Castro within a week after the fighting ended, is busy ministering to the medical needs of about 1,200 patients a day here.

Their presence is another indication of the changes that have occurred in Nicaragua since the fighting stopped in mid-July. A similar team of doctors sent by Castro after an earthquake that devastated Managua seven years ago was thrown out of the country by Somoza.

Here in Matagalpa, 60 miles northeast of Managua, patients stand in long lines outside San Vicente - or occupy its 120 beds - waiting to be treated by the Cuban medical staff for problems related to the extreme poverty that curses this part of Nicaragua or for problems related to the war, which leveled whole blocks in this small city of 45,000 population.

Malnutrition, trauma, gastrointestinal diseases and malaria, which is on the upsruge here because of a lack of pesticides, are common.

In a short time, the Cubans, who came equipped with tents, medicine, hospital beds, food supplies and even two motorcycles to facilitate their transportation in and around Matagalpa, have reorganized San Vicente and begun providing a full range of medical services, which are free to those in need.

They have also created a stir in a city that had heard nothing but anti-Cuban propaganda during the years when the Somoza government tried to portray the Sandinistas as wild-eyed communists bent on creating a Cuban-style dictatorship in Nicaragua.

When the Cuban medical team arrived in Matagalpa about two weeks ago "it was a great surprise," said Dr. Padilla, a U.S.-trained physician and a member of the local aristocracy. "Cubans in Matagalpa! It was the first time in history. We had thought of them as people from another planet."

Padilla said that in just two weeks the Cubans have dispelled their image as agents sent to foment revolution and have become the object of both affection for the work they are doing and curiosity on the part of people eager to meet them.

Dr. Gerardo de la Liera, a member of the Cuban team, said we and the others were sent to Matagalpa because "it's a Marxist principle to demonstrate solidarity with other peoples. We in Cuba do not have very much but what we have, we share."

The junta, which sent two of its members to Havana almost immediately after the war ended, is nonetheless sensitive about the Cuban presence. The doctors have been dispersed to relatively remote areas such as Matagalpa, or are quietly at work in outlying parts of the capital.

In all, more than 60 Cuban medical technicians are now at work in four Nicaraguan cities and more are expected. Castro has also offered to send teachers.The arrival Wednesday of a group of journalists from Havanna was given front-page coverage by Barricada, the ofificial newspaper of the ruling Sandinista-backed Junta of National Reconstruction.

Padilla said the Cuban doctors at San Vicente tend to stick together. They are billeted in the hospital and few tend to socialize with Nicaraguans after their work is finished. But Padilla, who has kept an eye on them, said they talk with the local Sandinista authorities from time to time.

The Cubans have made no attempt to talk politics with their patients, he added. They are well-trained, completely professional and have been quickly accepted, Padilla said. "There have been times when patients have asked me if I am a Cuban," he said. "When I say "no" they are disappointed. Many of them are coming for nothing more than aspirins - just to meet one of the foreigners." CAPTION: Picture, Dr. Ernesto Alavez, of Havanna, attends a patient in an emergency tent set up in Matagalpa. AP