FOR A MAN who just turned 40 in June, Muammar

Qaddafi has already achieved what few leaders ever do. He has fundamentally transformed his sprawling, sparsely populated country, his name is a household word (though not necessarily a nice one in many places) and he has had the peculiar distinction of being singled out by the Reagan administration as a leader who can send waves of fear through Washington. The mere rumor--and it has never been proved to be more than that--last December that Qaddafi had unleashed "hit squads" on America was enough to cause the Secret Service to increase noticeably protection for the president and other high officials.

These two new books attempt to examine the Qaddafi phenomenon in the broader context of Libyan history. Both are successful, though their approaches are vastly different, as their titles imply.

John Cooley's Libyan Sandstorm is a highly readable account of modern Libya filled with clouds of rumor and gossip, repeating all the bizarre tales and speculations that fill the daily lives of Middle East correspondents. Here one finds the real-world tracks of spies and conspirators, the dark intrigues and venal propensities of men struggling for power, influence and riches.

Cooley relates with relish such tales as the "Hilton Hotel Assignment," a James Bond-like story of European mercenaries plotting to assassinate Qaddafi at the beginning of the 1970s and being thwarted by Western intelligence agencies. There is a detailed account of Qaddafi's strange relationship with Frank Terpil and Edwin P. Wilson, two former (or were they former?) CIA agents who in the middle 1970s allegedly sold their black knowledge about such terrorist devices as timers capable of detonating explosives at predetermined times. There also are the stories of the "Hotel Project," Qaddafi's longtime effort to get an atomic bomb, including a request to the Chinese to buy one with abundant Libyan petrodollars, and the comic-opera relationship with Billy Carter and the Carter administration.

There is little of this high-tension, behind-the-scenes scheming in John Wright's methodical history, Libya: A Modern History. His is a more measured, sedate recounting of the years not only of Qaddafi but of the long period before his grasp of power in a 1969 coup. Yet his book, in its way, is as satisfying as Cooley's because of its clear exposition of Libya's evolution from an impoverished to an oil-rich nation.

Only 35 years ago Libya was so poor that in the wake of World War II the collecting of abandoned military equipment for sale as scrap metal in some years accounted for a full 13 percent of the country's exports. It was one of the poorest countries in the world, having an estimated per capita income of only $35 annually. There were high mortality and birth rates, widespread malnutrition, illiteracy and apathy after hundreds of years of foreign rule.

Beyond his recounting of Libya's history, Wright is strongest in his dealing with Libya's oil resources. The discovery in the late 1950s of huge pools of high-quality oil in the largely desert country fundamentally changed Libya's economy. And under Qaddafi the change has been dramatic. In 1961, oil exports amounted to a meager $3 million. By the time Qaddafi and his young military colleagues overthrew old King Idris in 1969, they amounted to $1.2 billion. In 1980, they came to a stunning $22 billion and there was enough of the highly prized low-sulfur, light crude left in the ground to maintain the daily production rate of 2 million barrels for the next 35 years.

All this wealth is being produced in a country of around 3 million people, which explains why, Cooley notes, that under Qaddafi Libyans have "become prosperous, and seem to lack nothing materially" -- even if they do lack political freedom.

Neither book, it seems to me, is successful in explaining Qaddafi's quirky personality -- perhaps because it is inexplicable outside of the realms of psychiatry.

Qaddafi's moods and long periods of desert solitude are already legendary. His austere puritanism is apparently no mere political artifice. He is a son of the desert, of semi-nomadic parents, a natural if eccentric leader who in the words of Wright "represents many Libyan characteristics: "fundamental simplicity, dignity and egalitarianism, dour puritanism and introverted xenophobia, extreme narrowness of cultural, historical and political experience."

Cooley is more successful in explaining the complex motives and influences that led Qaddafi to some of his seemingly quixotic efforts to unite with his suspicious and aloof neighbors, his adventures in Uganda and Chad, his flirtation with international terror and the Soviet Union, his rabid Islamism and anti-Zionism, his idolatry of Egypt's Gamal Abdel Nasser, his Islamic social experiments at home and quest for influence abroad, and his Orwellian venture into philosophy in his three-volume Green Book that outlines his modestly labeled "Third Universal Theory."

But Wright's virtues of detachment and scholarship are nonetheless impressive too and provide the background that any serious student values.

The publication of these two books in the same year is one of those happy events where the reader can profit by either one and profit most by reading both.