For the 17 years that Muammar Qaddafi has held power, nothing in his frequently erratic behavior has been more striking than his strong attraction to the United States. Despite years of officially hostile relations, the Libyan leader has given a special role to a host of free-wheeling Americans and high-technology U.S. companies in bolstering his regime.

Almost from the first day of his rule on Sept. 1, 1969, Qaddafi has been at odds with Washington over Middle East policies while also being fascinated by American high technology, expertise and modern-world gimmickry.

"You've got to understand: Qaddafi loves America," one U.S. analyst remarked. "He's stung by our rejection."

President Reagan seems to have his own fixation on Qaddafi and to have singled him out as a prime example of irresponsible leadership and state-sponsored international terrorism that the West must crush.

Reagan now appears determined to sever Qaddafi's special "American connection," apparently hoping to achieve through economic sanctions what the president has rejected -- at least now -- through military action.

Caught in the middle of this peculiarly personal Reagan-Qaddafi confrontation are four American oil firms, which are being asked to sacrifice their assets in Libya, with a value estimated by one U.S. banker at $1 billion.

Since 1969, Qaddafi has relied on U.S. expertise not only to run his oil fields, the source of his wealth and some say his terrorist activities, but also to build what he regards as his main legacy to the Libyan people: a $20 billion irrigation project he calls his "great dream" designed to make the Libyan desert bloom.

In the mid-1970s, Qaddafi even turned to ex-agents of the Central Intelligence Agency, such as Edwin Wilson, Frank Terpil and Kevin Mulcahy, and a score of former Green Beret soldiers, to train and equip terrorists.

"Americans helped Qaddafi set up his foreign terror network," wrote correspondent John K. Cooley in his authoritative book on the Libyan revolution. They sold him the "gimmickry and tools of terror," Cooley said.

The cloak-and-dagger intrigues and periodic crises in U.S.-Libyan relations since Qaddafi came to power are legion. For at least the first four years of his regime, Qaddafi was widely considered in the Middle East to enjoy the protection of the CIA and to be "America's man," as Cooley put it. This was because of his violent anti-communist pronouncements and criticism of most Soviet actions in the Middle East.

In at least two incidents, the CIA may have acted to prevent his overthrow, according to the accounts of Cooley and others, though this is still disputed.

In the late 1970s, then-President Jimmy Carter was embarrassed by the publicity surrounding his brother, Billy Carter, whom Qaddafi wooed with the offer of a loan and a visit to Libya in an unsuccessful bid to gain White House blessings.

As U.S.-Libyan relations have become more tense under the Reagan administration, Qaddafi has repeatedly sent messages to Washington through intermediaries of his desire to restore normal relations and regain international respectability, according to U.S. officials.

The four oil companies -- Occidental, Conoco, Marathon Oil and Amerada Hess -- are among roughly 50 U.S. firms providing U.S. services, technology and expertise to help keep Qaddafi's now economically troubled regime running.

The latest administration measures may be particularly onerous for the oil firms being asked to close down their operations and risk nationalization or forced sale to other foreign competitors.

Despite his revolutionary rhetoric, Qaddafi has treated American oil companies better than any other Arab leader over the past 15 tumultuous years in the industry. While all other Arab governments, including the most conservative Persian Gulf ones, have long since nationalized the Western oil firms in their countries, Libya still allows the Americans to own at least a share of the fields and to operate them.

This Libyan policy, according to U.S. analysts, has been due to the inability of Libyans to run the fields themselves and to Qaddafi's desire to continue nurturing his American connection.

There are conflicting views among U.S. oil experts whether the departure of the American companies, responsible for pumping 70 to 80 percent of Libya's 1.1 million barrrels a day of crude oil, would seriously disrupt the running of Libya's fields, and seriously cut into its current $10 billion-a-year oil revenues.

Qaddafi has also been sparing of the roughly 1,000 to 1,500 Americans willing to ignore earlier Reagan administration calls for them to depart. He has allowed them the special privilege of sending home most of their dollar earnings, unlike other foreign workers. He has also made special arrangements to help them avoid prosecution in the United States for being in Libya by not stamping their passports.