The recent expulsion of three U.S. diplomats from Nicaragua was the product of a two-year plan, authorized at high levels of the leftist Sandinista government in Managua, to discredit democratic opposition forces there through a web of false accusations, according to a former official of Nicaraguan state security.

The former official, Miguel Bolanos Hunter, said he was in charge of surreptitiously filming American diplomats as part of the plan and participated in meetings on the operation that were presided over by Lenin Cerna, director of the Direccion General de Seguridad del Estado (DGSE), the Nicaraguan Interior Ministry's department of state security.

Bolanos, 24, who led a 60-man guerrilla unit in the final battles that brought the Sandinistas to power in 1979, defected from Nicaragua six weeks ago by hijacking a light plane to Costa Rica. He has provided an unexpected intelligence bonanza for the very U.S. agencies he worked against for the last three years.

Bolanos had served briefly after the Nicaraguan revolution as special assistant to the Sandinista army chief of staff, Joaquin Cuadra.

From January 1980 until his defection May 7 he was an official of state security, nearly all of that time a counterintelligence case officer with special responsibility for surveillance of U.S. Embassy and CIA activities in Nicaragua.

Since leaving Costa Rica about three weeks ago as part of an arrangement with the U.S. Embassy there, Bolanos has been debriefed extensively by State Department and CIA officials.

Access to him was offered to reporters for The Washington Post by State Department officials, who arranged for meetings with Bolanos at the Heritage Foundation, a conservative think tank. Washington Post reporters interviewed him there for 13 hours late last week, with no questions barred.

Various independent sources here and in Central America confirmed Bolanos' identity, though it was impossible to obtain confirmation of the details he provided of the secretive and influential internal security apparatus in Nicaragua.

Bolanos' account includes detailed information about the presence and role of Soviet, Cuban, Bulgarian and East German advisers and assistance in the Nicaraguan security apparatus.

The defector said their presence is extensive, with two high-ranking Soviet officers and a Cuban officer assigned as advisers to the 35 Nicaraguans in the counterintelligence section where Bolanos worked.

He said many more such advisers worked with other Nicaraguan military and security forces.

Among other things, Bolanos said:

* Nicaraguan intelligence has deeply penetrated the anti-Sandinista guerrilla groups that have been fighting a U.S.-supported "secret war" against the Nicaraguan regime. The locations, armaments, personnel and many other details of insurgent activity have been passed along for many months by Nicaraguan agents who, according to Bolanos, include a close adviser to Eden Pastora, leader of one of the three major insurgent groups.

* The assassination of exiled Nicaraguan leader Gen. Anastasio Somoza in Paraguay in September, 1980, was planned in Managua with Cuban assistance. Bolanos said he knew Hugo Alfredo Yrurzun, the assassin who wielded the bazooka that blasted Somoza's automobile, as an interrogator in Nicaraguan state security in March, 1980. Yrurzun was gunned down by Paraguayan police after the assassination.

* Public demonstrations and heckling during the visit of Pope John Paul II to Managua last March were orchestrated by Nicaraguan state security, which placed thousands of pro-Sandinista Catholics in prominent positions for the papal mass and kept thousands of anti-Sandinista Catholics away. Bolanos said he helped control the event from an operation center near the public square in Managua, and that the pro-Sandinista slogans that interrupted the pontiff's homily had been chosen in advance by the security apparatus.

* Planning and training for the spectacular and damaging raid by leftist guerrillas in nearby El Salvador on the Salvadoran government military air base at Ilopango in January, 1982, was centered eight miles from Managua in a Nicaraguan facility under the supervision of a Cuban adviser. This account, which Bolanos said he learned from the Cuban adviser, illustrates the extensive support Bolanos said Nicaragua gives to the rebels fighting against the U.S.-backed government in El Salvador.

* About 80 Soviet-built MiG warplanes presently in Cuba have been designated for Nicaragua. Bolanos said he was told this by the head of the Nicaraguan Air Force, whom he identified as Raul Venerio. Because of U.S. warnings against bringing MiGs onto the land mass of Central America, the current plan, according to Bolanos, is for the MiGs to be based in Nicaragua only after the expected Sandinista victory in elections there in 1985. Nicaraguan pilots who have been undergoing training in eastern Europe will be ready to fly the jets starting next year, Bolanos said, and the planes would be flown on Nicaragua's behalf by an "international" group of communist pilots if they were needed before 1985.

* Orlando Jose Tardencillas, 19-year-old "Nicaraguan guerrilla" who embarrassed the Reagan administration by suddenly recanting his previous story before the Washington press in March, 1982, was put up to this by Sandinista officials. Bolanos quoted Cerna, chief of Nicaraguan state security, as saying that Tardencillas had passed word from a prison cell in El Salvador that U.S. officials wanted to use his participation in the Salvadoran war for propaganda purposes. According to this account, an order was secretly sent back to Tardencillas in prison to cooperate until he was brought before the American press and then to "turn around" to embarrass the U.S. government. Tardencillas, who was permitted to return home after the famous press conference, is now a national hero and a Sandinista youth leader in Nicaragua, according to Bolanos.

The man telling this story is the Managua-born son of an American, Gloria Hunter, and a Nicaraguan, Dr. Rodolfo Bolanos, an eye, ear, nose and throat surgeon. Young Miguel briefly attended several colleges in the United States before joining the Sandinista revolution against Somoza. His parents left Nicaragua for Miami, where they now live, after the revolutionaries took power.

Because of his upper-middle-class background and American connections, Bolanos said, Cuban advisers opposed his application to join the highly sensitive state security apparatus. But they were overruled by high-ranking Sandinistas who had known Bolanos as a comrade-in-arms.

Bolanos said he wanted to join the internal security service after being mistakenly detained by the secret police shortly after the revolution and realizing his captors had more power than anyone else in Nicaragua.

But, as Bolanos told it, this experience also played a part in his growing disillusionment with the revolution over the years. In addition, he cited the distinct minority status of his revolutionary faction, the terceristas, within the predominantly more radical security apparatus, his growing conviction that Nicaragua is heading down a totalitarian path and, finally and apparently most deeply felt, a sense of outrage at the luxurious living and special privileges of Sandinista leaders compared to the privations suffered by most of their followers.

Bolanos himself benefited from those privileges as a "militant," or full member of the Sandinista Party, a status he said is enjoyed by only 600 to 800 people. Other accounts have put party membership as high as 4,000.

Party members are permitted to shop at special stores which offer items that are unavailable or strictly rationed elsewhere, Bolanos said, and this spring party members were permitted to buy Cuban-made television sets, stoves and refrigerators at one-fourth or less of their open market prices.

Bolanos said the birth of a son last October was the beginning of the end. He determined then, he said, that "I'm not going to allow my son to become a slave or be in a slave system." After that, "my observations became more critical," and eventually he began to plan an escape.

Despite many privileges and impressive powers, internal security officers are not permitted to have passports or to travel abroad. But Bolanos was able to obtain a passport and exit permit for his wife and infant son to "visit relatives" in Costa Rica. They left Managua on a commercial airliner the morning of May 7.

As soon as he confirmed their departure, Bolanos boarded a light plane he had chartered the previous day to take him to a city near the Nicaraguan-Costa Rican border. As the aircraft approached its destination, he said, he drew his gun and ordered the pilot to continue across the border and land at an airport in Liberia, Costa Rica.

Bolanos said, and Costa Rican authorities confirmed, that he was taken into custody and charged with air piracy. Just what happened next is murky and reportedly was the subject of high-level discussions between Costa Rican and U.S. authorities. The result was that Bolanos was released from custody and left Costa Rica under U.S. auspices.

Bolanos said there were "no conditions" on his entry to the United States, pointing out that he has a claim through his mother to American citizenship, for which he has now applied. When he crossed the Costa Rican border, he was carrying an expired U.S. passport, which he had obtained during his student days as the son of an American woman.

He denied that he agreed to make public what he knew as a condition of coming here. He said the idea of telling his story to journalists was his from the beginning.

He is not being paid by the U.S. government, Bolanos said, nor has he been promised any protection. In order to remain unnoticed in the midst of the American people, he declined to have photographs published in which he could be recognized, although his picture is on file in Managua.

A spokesman at the Nicaraguan Embassy here, Angela Saballos, said yesterday that the embassy is aware of Bolanos' defection but added, "He was not in a decision-making position, so he did not have any inside information."

Eventually, Bolanos said, he hopes to fight for a new, non-communist, democratic revolution in Nicaragua, "maybe from some place closer to Nicaragua" than the United States. He declined to be more specific.

Bolanos described the atmosphere in Nicaragua's security apparatus as full of intrigue, aided and in some respects complicated by the presence of the experienced outsiders from communist countries. About 2,800 to 3,000 Nicaraguans in the department of state security are aided by about 70 Soviets, 400 Cubans, 40 to 50 East Germans and 20 to 25 Bulgarians, according to Bolanos. He estimated that there are about 2,000 Cuban military personnel in the country, most of them posing as teachers.

He said the Soviets, who used Cuban-adapted manuals of the KGB, the Soviet secret police, have provided Makarov automatic pistols as a comradely gesture to Nicaraguan security officers. He described the Russians as high-ranking--with one of the two Soviet officers assigned to his F2 section a colonel in the KGB--but as relatively restrained in their intervention compared with the Cubans.

Last year, for the first time according to Bolanos, the Soviets supplied sophisticated bugging devices to the Nicaraguans. Next year, he said, high-level Nicaraguan security agents are scheduled to attend a special KGB school in Moscow rather than be trained entirely in Cuba.

The other Europeans have less importance, according to Bolanos, who said that the East Germans are mainly advisers on hidden microphones and technical operations, and direct advisers and participants in the sub-section of F2 that operates against the West Germans and other European embassies. The Bulgarians, he said, have "a small center" to process information and supply occasional advice.

As Bolanos told it, the Cubans are in on just about everything and make their presence felt with a constant stream of advice bordering on directions. Bolanos said that, shortly before his defection, an argument broke out in the F2 section, with the Cuban adviser taking sides in a divisive way. As a result, he said, Cerna and other officials had the adviser sent back to Cuba.

Bolanos said that, like many Nicaraguan security officials, he was schooled in Cuba. He spent four months in mid-1980 at a school in a special security base south of the Havana airport where, he said, many teachers held class for Nicaraguans in the mornings and for Angolans in the afternoons.

The chief Cuban adviser to Cerna, whose working pseudonym is "Mayan," and several other Cubans were among those who worked on the plan to discredit the democratic opposition in Nicaragua by concocting a false conspiracy linking them to U.S. diplomats, according to Bolanos. "This is an element of the big strategic plan," he said, to eliminate all effective opposition to Sandinista rule by 1985, when national elections are to be held to resoundingly endorse the Sandinista regime.

Agents were used to lead American diplomats into suspicious situations, he said. He added that his unit of the F2 section was assigned to provide films of U.S. diplomats meeting Nicaraguans from democratic opposition parties and factions, the Catholic church, labor units, the press and private sector.

For six months, Bolanos said, he was in charge of shadowing Linda Pfeifel, political affairs officer of the U.S. Embassy. Bolanos said he supervised the bugging of Pfeifel's house and, on one occasion, personally searched her belongings.

"I knew everything about her," he said. "I knew where she went and what she did. I even knew what kind of deoderant she uses."

A great deal of film was shot over many months with Americans and their Nicaraguan contacts unwittingly in the starring roles, according to Bolanos, who said the idea was to produce a motion picture that would dramatically "expose" the supposed conspiracy.

He said the whole plan, which recently was given the name of "Operation Spiderweb," originally had been scheduled to be unveiled at the end of April with the expulsion of some American diplomats. It was postponed, Bolanos said, because of the desire to obtain more "incriminating" documentation.

It was after he left Nicaragua, Bolanos continued, that the security services added a final detail: the charge that Pfeifel supplied a bottle of poisoned liqueur to a double agent intended to be given to Nicaraguan Foreign Minister Miguel D'Escoto.

This was the high point of a June 6 press conference in Managua, in which Cerna participated and where videotapes were shown with James Bond-style sound track, announcing the expulsion of Pfeifel and two other U.S. diplomats on espionage charges.

The Reagan administration, which by then had been forewarned by Bolanos, responded June 7 by closing all six Nicaraguan consulates in the United States and expelling their 21 diplomatic personnel.