As the visitors entered their classroom, the junior high school students snapped smartly to attention and stared silently at the wall while one grave black youth stepped forward and shouted a greeting in a drill sergeant's voice.

"Comrade visitors: We are the Angolan Pioneers, the beacon and guide of the continent. We commit ourselves to our organization, to the MPLA Workers Party, to our people and to President Neto. Long live the Angolan revolution, surviving our own Bay of Pigs in Africa. The struggle continues, the victory certain. Fatherland or death. We will overcome."

The formalities dispensed with, they raised a clenched-fist salute, smiled shyly and sat back down to their studies.

Boys and girls between the ages of 12 and 16, the students are among more than 2,000 Mozambican and Angolan children brought thousands of miles across the Atlantic as part of Cuba's aid program to Africa, complementing the presence of what U.S. officials say are 40,000 Cuban troops on their continent.

In a program that began last fall, and this year will add an additional 1,000 Ethiopian students, they will spend from one to three years here. In addition to a regular academic curriculum, they spend several hours each school day, along with 20,000 Cuban students, working in the citrus groves that cover nearly a third of this small island 60 miles off Cuba's southwest coast.

The Isle of Pines is a sort of mass boarding school that is the showpiece of Cuba's extensive "schools in the countryside" system designed to teach the value of manual labor along with traditional academic subjects.

A mostly flat, swampy expanse, dotted with occasional lunar-like hills rich in marble, the once sparsely populated island previously served as Cuba's main prison, holding "revolutionaries" opposed to a series of 20th century tyrants.

It was here that the young Fidel Castro was kept in solitary confinement following the 1953 rebel attack on Santiago's Moncada Barracks, which Cubans consider the beginning of their Marxist-Leninist revolution.

It was here that the young Fidel Castro was kept in solitary confinement following the 1953 rebel attack on Santiago's Moncada Barracks, while Cubans consider the beginning of their Marxist-Leninist revolution.

It was also here that victorious Castro sent captured "counterrevolutionaries," including many of the 1961 Bay of Pigs invaders, in the first years of his government.

The prison itself, which Cubans say was modeled in 1927 after the Federal Penitentiary in Joliet, Ill., is an ingenious structure composed of four massive, circular buildings. Each is lined with 465 cells, measuring 3 by 8 feet and designed for two prisoners stacked in five layers around a bare covered courtyard.

While the window in each cell, Facing outside stairway locked, and a solitary circular tower in the center of each courtyard from which two guards could view the entire building, the structures resemble giant bird cages whose occupants were given the illusion of open-air freedom while kept zoo-like surveillance.

In 1966, Castro closed the facility, transferred the prisoners and renamed the island the Isle of Youth. It was here, Castro declared, that Cuba would begin building the schools that would fulfill the maxim of Jose Marti, the 19th Century nationalist martyr, that Cuban students should use "the pen . . . in the afternoon, but the hoe in the morning."

Today, more than half of the island's population is composed of students, most in seven, eighth and ninth grades.

Most of the rest of the population perform support services for the 41 secondary schools of work as technicians for the thousands of acres of citrus trees that provide both a working student laboratory and substantial exports to the Soviet bloc.

Georgina Gonzalez, one of the approximately 2,000 Cuban Communist Party members who service the government "even tried to turn the prison into a school. Then we thought of turning it into a hotel" or a sports colosseum.

The prison is, now kept as a museum, with the yellow-sheeted beds of the Moncada prisoners preserved as shrines.

The secondary schools themselves, dotted miles apart among the grapefruit groves, are prefabricated, two-story domitory, dining and classroom complexes with names like heroic Vietnam. The children in the Angolan classroom are part of President Agostinho Neto secondary school, one of four of the 600-student complexes devoted exclusively to Africans.

Julio Monteiro Funtodo, a 14-year-old Angolan, sat in the classroom busily drawing an electrical conduction system and explained his presence.

"We came last November," he said, "and I guess we'll stay until we complete our course of study. I don't really know when we're going home.

Many of the Angolan children, explained Virgilio Antonio, an Angolan teacher who accompanied them here, are the specially selected sons and daughters of Popular Movement for the Liberation of Angela soldiers killed during the 1976-76 Angolan civil war. The MPLA, as its initials read in Portuguese, is now Angola's ruling party.

Others are taken from villages throughout Angola, where he said 80 percent of the population is illiterate, after they show higher than average aptitude and educational levels.

The mass importation of the students, island education director Jose Luis Reyes explained, was a decision hastily made last year "by the [Communist] party and the [Cuban] government to offer assistance in the quickest way possible." The African students, who are expected to form the base of a new generation of technocrats in their own country, complement what the Cubans say are more than 700 Cuban secondary school teachers now working in Angola alone.

The children are taught in Spanish, along with classes on grammar in Portugues - with which they were already familiar. Special Angolian foods, like Funje , a dish made from stewed yucca roots, are provided.

"They don't feel sad to be here," Virgilio Antoni said, "because they are all here of their own free will and are in constant touch with their families. They are happy to be in this type of education program which does not exist in our country."

If the students themselves feel otherwise, they withheld their views during conversations with visitors that were monitored by school officials. All, however, appeared happy, well-fed and bright.

While parents of both the Africans and Cuban children here are free to visit them at any time, few Africans can make the trip. The Angolan students, however, are displayed to each of the large number of official delegations their country sends to Cuba. Flags of both nations fly above the Neto school.

All of the African students, like the Cuban youths, wear the uniforms of the Pioneers, the socialist world's counterpart of the West's Boy and Girl Scouts. Their ideological training is monitored by a resident member of the MPLA.

But militancy obviously makes room for more childlike pursuits on The Isle of Pines. While the Cuban schools each have their own baseball field, the Africans are supplied with fields for soccer, their favorite sport.

In the Neto's school's spotless 60-bed dormitories, the neatness of the tautly made bunkbeds in the girls' quarters was rivaled by a row of alternating black and white dolls, lined along the main corridor with military precision, waiting patiently for their owners to return from the fields.