AS A GREEN BERET, he was accustomed to clandestine assignments in exotic places. But this was different.

Before, whether in Southeast Asia or the Dominican Republic, he'd always known that he was working for the United States. But now he was in Libya, an avowed enemy of the United States, working for its terrorist-prone military.

He had been in Tripoli less than a week when he was first taken to see the base of operations for the the group he had joined. With another American at the wheel, they drove about 20 miles south of their luxury seaside hotel until the sandy stretches of North African desert gave way to a lush orange grove. The car stopped at the end of the grove in front of the palace of the former king of Libya, who had been ousted in 1969 by Muammar Qaddafi, the Libyan leader.

Behind a set of locked doors in the basement of the servants' quarters was located, in effect, a small American munitions factory, stocked with explosives shipped from the United States. There a group of Americans was busy camouflaging small bombs as lamps, candles, briefcases and ashtrays.

The Green Beret, who less than 10 days earlier had been going through routine Army drills at Fort Bragg, N.C., was now part of an ongoing operation which, from 1976 through at least 1979, is alleged to have provided terrorist training and explosives for the Libyan government.

At its simplest, this story tells how a growing band of mercenaries, many of them Americans, sold their daring and special knowledge to the highest bidder -- in this instance, the forces of international terrorism. But some of the Americans involved in the Libyan project -- including the Green Beret who was given a leave of absence by his superiors to take part in the operation -- are convinced that the U.S. government knew full well what they were doing, and may have let it continue longer than it should have, in hopes of infiltrating the international terrorist movement. Qaddafi, after all, has openly financed such groups as the Palestine Liberation Organization, Italy's Red Brigades, the Irish Republican Army, the Japanese Red Army, Germany's Baader-Meinhoff gany, and others.

Even more troubling to the State Department is what Americans may still be doling in Libya today.

At present, according to State Department intelligance, there are more than a dozen, and perhaps as many as 50, Americans -- not necessarily connected to the Americans in the following report -- in Libya providing military support to the government.

State Department sources fear that some Americans may have had a hand in training the Libyan commandos believed responsible for last year's execution of 11 Libyan exiles living in Europe.

Potentially more damaging is the indication from State Department sources that the Libyans have suddenly shown a "certain sophisticated awareness of U.S. intelligence capabilities and the nature of U.S. operations worldwide." It is another indication the U.S.-trained mercenaries are selling their skills and knowledge abroad.

The problem of the involvement of Americans in supporting international terrorists "is much greater than recognized," according to other federal investigators. On the first page of one confidential report, the officials wrote:

"The United States, in effect, has become a major supplier of [military] hardware and technology in support of worldwide terrorism. Former Central Intelligence Agency personnel, military Special Forces personnel, and U.S. corporations combine to supply products and expertise to whomever can pay the price."

There is little doubt that the project the Green Beret found himself involved in was a scheme hatched by two former Central Intelligence Agency employes, Edwin P. Wilson and Francis F. Terpil, who used their expertise to design a program that supplied explosives and people to train terrorists in Libya.

Undercutting the participants speculation that the United States sanctioned Wilson's and Terpil's activities is the fact that when one of the first Americans recruited for the Libyan affair informed the CIA of the operation in September 1976, the agency notified the FBI. On the other hand, the operation continued at least until late December 1979, according to a federal investigators' report -- more than three years after the FBI investigation was begun.

Up to that point, federal investigators now allege:

More than 20 Americans, including five former CIA employes, a Green Beret on leave, five ex-Green Berets and two civilian naval engineers, were flown to Libya to perform a wide variety of support activities for Qaddafi's military.

Some of the Americans were put to work camouflaging terrorist bombs while others trained Libyan cammandos in everything from bomb detonation to parachute jumping.

And the shipping to Libya of millions of dollars' worth of military hardware, including 25,000 pounds of explosives and a ground-to-air Redeye missile, was contracted for without the the required approval of the State Department. The Libyans willingly paid the enormous, marked-up prices that their American suppliers charged for the hardware.

Last spring, Terpil and Wilson were indicted by a federal grand jury in Washington in connection with their Libyan dealings. Neither man appeared for trial and both are believed to have fled the country. A third man, Jerome S. Brower, head of a California explosives supply firm, was also indicted in the Libyan scheme. He pleaded guilty in December to a charge of conspiracy to violate federal arms transportation laws and is cooperating with the government while he awaits sentencing.

Terpil could not be located for an interview, and Brower refused any comment. Wilson, reached by phone in Tripoli, would say only that he is "an American businessman here on business"; he refused to speak about his past or present dealings in Libya.

Wilson and Terpil were an unlikely pair for a business partnership. Their backgrounds, business contacts and styles of living were almost exactly opposites.

Terpil, 41, was born in Brooklyn and retained the tough look and swagger of the New York streets. He boasted of his work for the CIA, and although some people knew it wasn't true, Terpil would allude to covert operations in Latin American as if he had participated in them.

But by most accounts, Terpil was actually one of the agency's lesser lights. According to sources, he repaired code-breaking equipment until he was fired in 1971, reportedly for failing to keep the low profile expected of CIA agents.

By contrast, Wilson, an imposing figure standing about 6 feet 5 and weighing 240 pounds, epitomized the finest in Washington manners. A member of the Georgetown and University clubs, he fit in comfortably with congressmen, businessmen, and Pentagon and CIA executives, many of whom he invited out to his $6 million, 3,000-acre Fauquier County estate for weekends of hunting, horseback riding and barbecues.

Wilson joined the CIA some time after serving in the Korean War as a Marine. While his exact duties with the agency are not known, two sources familiar with his work identified him as involved in two important '60s covert operations: the sprawling, post-Bay of Pigs, anti-Castro operation based in Miami code-named JM Wave; and the search for the Cuban revolutionary leader Che Guevara in Bolivia in 1967.

Sometime in 1971, Wilson left the CIA and spent five years working for the U.S. Navy's Task Force 157, a highly secret spy group created to carry on covert operations internationlly.

Wilson's work involved running one of the four or five companies ("proprietaries") used to pay agents in the field and ship support equipment to them.

Wilson's involvement with the task force was suddenly terminated, however, in April 1976, when he indiscreetly approached Adm. Bobby Ray Inman, then director of naval intelligence, with a business propostion: If Inman would channel Navy contracts to Wilson's private company, Wilson would lobby his congressional contracts to assist Inman in having Congress approve his budget requests. In addition, Wilson proposed that Inman consider disbanding Task Force 157 as it was then structured and setting up a new operation with Wilson in charge.

According to federal officials, Inman, who went on to become director of the National Security Agency before recently accepting President Reagan's appointment as deputy director of the CIA, was "astounded" by Wilson's proposals. He immediately informed the FBI of the conversation, ordered that Wilson be fired from Task Force 157, and, a short time later, recommended that the entire organization be dissolved.

According to reports by the U.S. Bureau of Alcohol, Tobacco and Firearms as well as numerous interviews with both federal officials and participants in the Libyan operation, the scheme worked this way:

In the spring of 1976, Terpil and Wilson traveled to Pomona, Calif., to meet with Brower, who, besides being a federally licensed explosives manufacture, was also a member of a congressional explosives advisory panel.

Brower, 61, agreed in principle to supply Terpil and Wilson with the explosives they needed to satisfy a contract with the Libyan government, authorities assert.

Federal investigators say that it was through Terpil's contracts in Britian that the Libyan deal was obtained. Terpil, who owns a town house in London, was introduced at a party to Quaddafi's cousin, Sayid Quaddafi, then the chief buyer of sophisticated electronics equipment for the Libyan army.

On Aug. 13, 1976, Terpil, Wilson Brower and several others met in Washington at the offices of Intertechnology Inc., a new Terpil-Wilson company. There, officials allege, the three formally agreed to ship quantities of explosives to Libya without securing the requisite State Department approval. Authorities refer to this session as the conspiracy meeting.

The same day, Brower's company in California , J.S. Brower and Associates, shipped the first load of explosives to Tripoli, according to reports. They were packed in black 50-gallon drums marked "Industrial Solvent."

A short time later, Wilson and Terpil began sending recruits to Libya to implement the personnel training and explosive manufacturing provisions of their agreement with Qaddafi. Among them were John H. Harper, a retired CIA ordinance technician, and his son, John Jr., both of Virginia, who helped set up the explosive manufacturing plant in the Libyan palace complex. Later, the younger Harper told investigators that during his three-week stay in Libya, for which he was paid $7,000, he constructed 25 concealed bombs.

However, he said he and his father abandoned the project because they "knew [the bombs] were for terrorist use and innocent lives would be lost."

Douglas M. Schlacter of Upperville, Va., a friend and business associate of Wilson's, was also recruited during the early stages of the operation, but, unlike the Harpers, he remained in Libya, for the most part acting as Wilson's and Terpil's go-between with the other Americans as they arrived.

Apparently dissatisfied with the explosives manufacturing done in Libya by the Harpers, Wilson prevailed upon Bower to recruit other operatives. Brower found four men, all from the West Coast. Two of them, Robert E. Swallow and Dennis J. Wilson, were engineers assigned to the China Lake Naval Weapons Station, a remote installation in California's Mojave Desert that conducts top-secret research in the development of new weapons systems for the United States.

Swallow and Wilson took leaves from China Lake to go to Libya. When their work was done in Libya, they returned to their jobs at China Lake.

Another of the West Coast recruits, who agreed to a telephone interview on the condition that his name not be used, said he went to Libya as a favor to Bower and because he thought he was participating in a CIA operation. However, nothing explicitly indicating agency involvement was mentioned to him.

"They [Terpil and Wilson] said not to worry, because they had it covered," the recruit said.

After being briefed by Wilson in Washington, the four men flew to Libya, where Schlacter picked them up and drove them to what he said would be their operations center, the palace of the former king. Adjoining the palace was a smaller building, which had been the servants' quarters. This was where the Americans actually built the bombs.

Terpil, Wilson and Brower each made a few visits to Tripoli during the time he was there, according to the source. He said Wilson offered him a raise and asked him to stay on. But he had had more than enough and couldn't wait to get home.

"I regret the whole thing," the West Coast recruit said. "I wish I'd never heard of Wilson and Terpil. I think they're out plowing up a whole bunch of cash and not afraid of who they have to step on to do it . . . But there's still a question in my mind as to the role of the Cia. No one's ever answered that question. How do you check out something like that? Even if you ask the right people, you're going to get the wrong answer."

According to the federal reports, on the evening of July 21, 1977, Luke F. Thompson, a Green Beret master sergeant at Fort Bragg, received a phone call in his Fayetteville, N.C., home from a man identifying himself as Pat Loomis.

Loomis and another man, it turns out, had been fired from the CIA by agency director Stansfield Turner less than three months before for allegedly assisting Wilson in buying explosive devices bound for Libya, devices that could only legally be purchased by the U.S. government.

Thompson later told federal authorities that Loomis asked him if he would be available to recruit and head a four-man team to undertake an assignment overseas for which Special Forces skills would be required.

The following day, Thompson called Loomis to say that he and a group of four ex-Green Berets he had previously served with would be available. Loomis asked to meet Thompson and his team at the Fayetteville Sheraton.

Before this meeting, one of the recruits, nervous that Loomis might be an agent provocateur for a hostile foreign power, informed military intelligence officials at Fort Bragg of the overture.

"I was told they had checked the operation out and there was nothing wrong with it," said the Green Beret, who agreed to an interview recently on the condition that his name not be revealed. "I assumed that they meant I was going to do a job for the Agency."

To participate in the project, the Green Beret asked for and was immediately granted a 30-day leave.

Recalls the Green Beret source: "Loomis began by saying: 'My name is Pat Loomis and I'm with the CIA. I've just come out of deep cover in the aircraft industry in Indonesia. I don't know any of you people. One man here has been thoroughly investigated. I don't know the rest of you and I don't want to know you.'"

Loomis told the men they would be paid $4,500 a month plus a $15,000 bonus at the end of the year. He would provide no further details of the mission, insisting that that information would have to be given outside the country.

A few days later the group went to Washington, where a woman (who turned out to be Loomis' wife) provided them with passports. Inside each one was $1,000 in cash but no visas, according to the source.

It was not until the following morning, when Pat Loomis handed them their plane tickets, that the Green Berets learned they were bound for Tripoli, via Zurich. Loomis said they would have no trouble spotting their contact because he was a tall man who would be wearing a red suit and a gold Rolex watch. At the Zurich airport, Ed Wilson was instantly recognizable to them.

After arriving in Libya the group was introduced to the chief off Libyan intelligence, Abdul Senussi also a member of the country's Revolutionary Council.

Over mint tea, Senussi began telling the Americans of a problem he had with Egypt. A group of about 800 Egyptian soldiers had apparently crossed the border into Libya and had to be driven back. He was interested in any U.S. expertise on how best to accomplish this. Senussi suggested the Americans devise a gas that could put the Egyptians to sleep. When the Americans politely scoffed at this idea, Senussi abruptly ended the meeting.

The Green Berets checked into a plush, beachfront hotel, where all their accommodations had been prepaid by the Libyan government. They were given a list of stores at which they could simply sign for anything they wanted. Cars were made available, and they were given Libyan driver's licenses. Guards with machine guns were stationed outside their hotel room doors.

Two days later, Schlacter reappeared at the hotel, seemingly in a hurry. He ordered the group to get ready quickly for another meeting with Senussi, the intelligence chief.

Senussi directed the Green Berets to establish a terrorist training program for Libya's commandos.

"At this point," the Green Beret source recalled, "it became clear to me that we were working for hostile foreign intelligence."

Concerned that they were now totally at the mercy of the Libyans, whom they did not trust, the source said he and the other Green Berets formulated "escape and evasion" plans in case they had to get out of the country quickly.

Because it was too soon to leave without arousing suspicion, the Green Beret source said that he and his team spent most of the next three weeks in their hotel rooms mapping out a comprehensive terrorist training program.

After a month, he said, he approached Schlacter and, citing pressing personal business at home, told him he would have to return to the United States. Schlacter offered no argument and, within a few hours, presented him with a round-trip airline ticket.

On his return to the United States, the Green Beret was extensively debriefed by military intelligence personnel at Fort Bragg. Then, apparently wanting reassurance that the Libyan operation was in fact legitimate, Fort Bragg officials decided to call in the FBI.

In a telephone interview, Robert H. Caverly, then a resident agent for the bureau in Fayetteville but now retired, said he told Fort Bragg military officials he would seek "clarification" from the Justice Department to determine if it was a CIA operation. But the clarification from Washington never came.

The Green Beret began receiving anonymous telephoned threats, warning him to stop talking to the authorities. As a precaution, military officials moved him from Fort Bragg to the Naval Special Warfare Department in Little Creek, Va., where he served as an "unconventional warfare adviser."

His superiors at Fort Bragg, he said, ordered him to continue participating in the operation -- without returning to Tripoli. Following their instructions, the Green Beret agreed to act as the operation's supply officer in the United States, and he recruited three more ex-Green Berets to go to Libya.

Requests for supplies were sent to him in code. Among the supplies he provided in at least two large shipments were technical training manuals and military boots. Fort Bragg military officials carefully catalogued the items before they were sent to Loomis, who then forwarded them on to Tripoli.

As his involvement in the Libyan affair began to wind down, the Green Beret source said he learned that Wilson had been subpoenaed to testify in Washington before a fedral grand jury that was investigating his dealings with Libya. In February 1978, the source received his own subpoena.

A few days before his appearance, he visited CIA headquarters at his own request, looking for "guidance" as to how much he should tell the grand jury. Ushered into an office in the clandestine operations section, the source said he was introduced to an official who told im that since the Libyan operation had nothing to do with the CIA, he was free to tell the grand jury anything he wished. The Green Beret's skepticism remained, however.

"I've been lied to by the agency," the source said.

"I'm only speculating," he concluded, "but I believe Ed Wilson was turned loose to get a handle on Libya. He was allowed to establish a very profitable private enterprise with a co-allegiance to the CIA. We were the low-paid infiltrators. We were expendable."

Federal prosecutors say that today both Terpil and Wilson are the targets of international manhunts. Terpil is believed to be hiding in either Libya or Syria (which do not have extradition treaties with the United States). Wilson, on the other hand, was spotted and briefly detained last August in Malta, where he owns a villa.

According to Assistant U.S. Attorney E. Lawrence Barcella, the American consulate in Malta was notified by local police and told a meeting would be set up shortly to arrange deportation of Wilson to the United States. However, at a hearing on Aug. 28, a police inspector informed the court magistrate that Wilson had been released from jail the night before and placed on a commercial flight to London. Although Maltese authorities had taken Wilson's passport, by the time he stepped off the plane at London's Heathrow Airport, he had another one to get through customs.

Barcella is tight-lipped about the slipup in Mapta. "We've never gotten a satisfactory explanation from Malta about what happened," he said recently. "I don't know if we'll ever get another chance at him like that."