The dealings between Billy Carter and Libya, now the subject of two major U.S. investigations, have focused attention on a little-known ally of Col. Mummar Qaddafi who has largely supplanted the Foreign Ministry in handling Libya's affairs abroad.

Ahmed Shahati, who heads Libya's "foreign liaison bureau," a shadowy arm of Qaddafi's people's revolution that appears more powerful than the official Foreign Ministry, was instrumental in initiating Libya's contact with Billy Carter two years ago, as part of an effort to improve the image abroad of Qaddafi's government.

Shahati, according to accounts by Libya analysts here and others familiar with the affair, arranged the $220,000 loan to Carter.

Some accounts have said that Shahati also promised to make significant new supplies of oil available to Billy Carter for placement with U.S. importers, to benefit him further financially. But most analysts in Italy, a key vantage point for monitoring Libya, doubt that Shahati had the power to make good on such promises.

They note that Carter apparently had no dealings with any of Libya's petroleum officials, whose approval would be needed.

Libyan leader Qaddafi, in an interveiw yesterday with The New York Times, his first public statement on the affair, defended his nation's relationship with Billy Carter and said the loan to the U.S. president's brother was a business transaction.

["Of course it is a loan and it will be repaid," The Times quoted Qaddafi as saying."It is a loan related to business. Is it forbidden to do business with Americans? We have American oil companies here that are doing business all the time -- why not question them? American banks are filled with Libyan dollar deposits on loans. Why not put them on trial, too? Why only Billy Carter? Why are they hounding Billy Carter?"]

Asked whether Carter's business deals involved oil purchases, The Times said, Qaddafi answered, "Maybe, probably. All the details on this are with the (foreign liaison bureau)."

Asked about an allegation made in Tripoli last week that Billy Carter's party had left Libya with a gift from Libyans for President Carter estimated to be worth possibly $50,000, The Times said Qaddafi replied:

["I have no knowledge of gifts, financial assistance or loans because I don't really get involved in these ordinary matters. But I should say that as far as we are concerned, we have no reservations at all about giving gifts to our guests or sending gifts to relatives . . . It is considered part of our obligations as hosts and part of our traditions."]

Before the Qaddafi interview, the only official Libyan statement on the Billy Carter affair had been made by the foreign liaison bureau Friday and published by Libya's government news agency.

It said Libya's relations with Billy Carter had been "normal" and only part of a much larger campaign to open a "dialogue" between the Libyan and American people. That these "normal ties" had been blown up to attack Billy Carter, the statement said, was nothing but part of an aggressive Zionist campaign" aimed at destroying anyone willing to try to understand Libya.

The statement by the foreign liaison bureau, however, raised almost as many questions as it answered.

It did not mention the controversial $220,000 loan nor did it shed any light on the oil deals that Carter, at least seemed to think were being dangled.

The statement did, however, bring to question once again just what the foreign liaison bureau is, how it fits into the structure of the Libyan system and just what Shahati's real powers are.

The emergence of Shahati and his foreign liaison bureau has its origins in the fall of 1978 when Qaddafi -- who at 27 had led a bloodless coup in 1969 to depose the aging King Idris -- announced that he planned to shed his "executive and administrative responsibilities" to devote his future energies to "revolutionary action" aimed at a vague popular mobilization that would rule the country directly.

"Power will be directly exercised by the masses, who will be organized in popular committees and congresses," he proclaimed.

That speech, which reflected ideas he had earlier formulated in his Green Book, promoting a revolutionary interpretation of the Koran, was the start of Libya's cultural revolution.

Qaddafi's decision to step back and become the spiritual leader of the government, rather than its formal head of state, was ratified in March 1979 by the General People's Congress, the nation's highest political body.It formed a new Cabinet, officially called a "popular committee," under the presidency of Azzouz Talhi, a former industry minister. Ali Abdel Salam Treiki, was appointed foreign minister.

Neither Qaddafi's close ally, Maj. Abdul Salaam Jalloud, the de facto prime minister since the revolution, or Shahati were on the official Cabinet list.

For all intents and purposes, however, Jalloud has continued to preside over the government even without a title and Talhi's authority and functions have been largely ceremonial.

Shahati clearly was assigned to try to purchase Libya a better image in a world that often has viewed Qaddafi as something of a madman and his country as a haven for terrorists.

While Shahati was corralling Billy Carter and showering charm and money on other Americans and institutions that seemed promising to the cause, the revolution at home took on ominous tones with mass arrests of "corrupt" officials, military men, businessmen and simple traders.

Some 1,800 persons in all, maybe a quarter of them military, have been arrested. For most of the year Tripoli television has run coverage of the "corruption" trials, from which hundreds at least have been condemned to death. Other "enemies of the revolution" in exile abroad were hunted down and killed in European cities, apparently by special assassination squads.

Shahati's opportunity came last fall when Qaddafi turned his ire on his own government, singling out the Foreign Ministry for special attack.

"All embassies continue to represent government bodies," he said, "at a time when the government has disappeared in the Libyan [revolution] with the establishment of people's powers."

Students and embassy clerks were ordered to take over their foreign embassies, renamed "people's bureaus" and administered not by ambassadors but political committees usually headed by five or six students.

Shahati's foreign liaison bureau emerged as the revolutionary umbrella under which these people's bureaus abroad would operate, even though the Foreign Ministry, to the knowledge of diplomats here, still exists under Foreign Minister Treiki.

Shahati in effect has become the head of a parallel foreign establishment of young revolutionaries who adhere to none of the diplomatic conventions, protocols and niceties that they consider to have been imposed on the world by the imperialist West.

Italian Foreign Ministry officials maintain, however, that Treiki remains officially Libya's foreign minister. They say that governments whose Libyan embassies have been taken over by people's committees report in Tripoli to Shahati, but that those whose embassies have not yet been turned into people's bureaus -- still a considerable number -- do their business with Treiki and the Foreign Ministry.

The Libyan mission in the United States, like many in Western Europe, is now headed by a five-member people's committee and all the other diplomats are designated "member of people's bureau."