"Nobody should think the colonel is mad," said one European diplomat who studies Libyan leader Muammar Qaddafi closely day by day. "He is not mad at all. He doesn't know Europe or America or the world, but he knows how to play with the United States.

"He follows his ideas. He follows his dreams in a way," the diplomat said, rolling his eyes toward the ceiling of his office. "But in a quite coherent way."

What America has seen of Col. Muammar Qaddafi since he was accused by the Reagan administration of backing Palestinian attackers in the Rome and Vienna airport massacres is a man seemingly filled with vanity and delusions of great power, a leader obsessed with his image and his imaginings.

But in the shuttered streets of Tripoli, among the chanting crowds of popular congresses and in the headquarters of student revolutionary committees, the posturing and prophesying have become a curious, sometimes painful, but still a functioning way of life.

Qaddafi's jamahariya, or state of the masses, is in his eyes a "concrete utopia." Communists and other ideologues "failed in creating a utopia because it is imaginary," he told a group of women reporters last week. "The jamahariya is the dream of society that man could achieve."

In the 16 years since Qaddafi seized power as a young lieutenant in the Army Signal Corps, toppling the corrupt King Idris, he has brought a backward nation with a population the same as the Washington metropolitan area (3.6 million) to heights of fame and infamy few could have expected.

Oil has given him the money to experiment with an ideology that verges on anarchy and make it seem -- for a while, to some of his people -- to work.

His international obsession, the restoration of Palestine to the Palestinians and the unification of the fractured Arab world into one great nation, are common throughout the region. Most Arabs probably would subscribe to these ideals with or without him. But Qaddafi has pursued them with the zeal of a fanatic and the tactics of a holy warrior convinced that nothing is evil that serves the cause.

When Qaddafi, the son of a Bedouin of Surt Province, was a schoolboy in Sabha, these were the goals of president Gamal Abdel Nasser's revolution in Egypt. Nasser was "our teacher," Qaddafi said at a press conference last week, then mused as if to himself in the face of the television cameras: "Was Nasser a terrorist? Anyway, he was our leader."

To understand Qaddafi, according to the diplomats who study him, it is necessary to understand his dreams. But more than that, one needs to examine the practical steps he takes to keep them and his country and himself alive.

At the moment, for instance, one of Qaddafi's weakest points would seem to be Libya's economy. The Reagan administration is literally banking on this by calling for an international boycott of Libya and freezing its assets in the United States.

Since oil prices and production began to plunge in 1981, vital imports have been reduced radically. The glutted shelves of stores and supermarkets have given way to dusty emptiness. Most days, no meat, no eggs, no vegetables are available at official prices and the only market that is well stocked is the black one, according to residents.

Poor distribution has made matters worse. Although bananas are grown in Benghazi, for instance, this favorite fruit is rarely seen in Tripoli. When a banana boat from Nicaragua arrived here a few months ago there were riots outside fruit stores that cost at least two lives, according to diplomats.

Qaddafi's oil wells allowed him in the 1970s and early 1980s to build his unique notion of democracy for Libyans on the labor of workers brought in from abroad.

"Partners, not wage workers," a favorite motto from Qaddafi's manifesto, "The Green Book," was easily applied when menial work was limited to noncitizens. But as oil revenues and production continue to decline, many of the foreign workers have left or been expelled: 100,000 in the last 18 months, according to diplomats.

Now long lines for bread are a common sight in a city that has lost its Tunisian bakers.

"The main basis of Qaddafi's popularity was economic prosperity, not his ideology," said one conservative European diplomat. "Whenever frictions arose because of his ideology, he covered them up by spending money. He can't do that anymore."

Yet a confidential staff report on Libya by an International Monetary Fund team last May suggested that given the difficulties faced by most oil countries, Qaddafi's is doing well in economic and fiscal terms.

The balance-of-payments deficit was reduced from $5.13 billion in 1981 to about $1.8 billion by 1985. Oil production dropped from 2 million barrels a day in 1979 to about 990,000 barrels in 1984, the report says. Diplomats put it currently at about 960,000 barrels. But almost all of this is exported. Domestic consumption is down to about 30,000 barrels a day, cut to a quarter of what it was six years ago.

In 1980, oil sales brought Qaddafi about $19.5 billion, according to IMF figures. By 1984, this had dropped to $10.4 billion, and last year, according to diplomats, oil revenues had fallen yet again, to about $8 billion.

The usually hard-to-please IMF staff nevertheless concluded that Qaddafi's restrained spending to balance revenues and expenses both internally and externally was "commendable."

Diplomats and some Libyans raise questions about the money Qaddafi spends on arms. His military debt to the Soviet Union alone is estimated at $4 billion to $5 billion out of a total external debt of $7 billion. Oil prices are still dropping and harder times loom ahead.

But each time Libya faces an external military threat, as it has several times in recent months, the arms are made to seem a good investment.

In several recent interviews Qaddafi has warned that the United States might force him to become the Cuba of the Mediterranean, allowing Soviet bases here, something he has not yet done.

But this may be a ploy for publicity. Qaddafi, who has welcomed the usually excluded world press to Libya in the last three weeks, finds his reflection constantly enlarged in the mirror of the United States and its anger.

The threat to go communist also strikes a note of fear in Europe.

"It is not an advantage to put the country totally into the hands of the Soviets," said one diplomat who favors dialogue with Qaddafi, "especially considering the strategic position of the country." Already some diplomats estimate that there are as many as 5,000 Soviet advisers here.

But several envoys with long experience in Libya doubt that the highly independent and devoutly Moslem colonel would embrace atheistic communism, or risk being embraced by it.

"I think it's the last thing he would do," said one veteran diplomat. "He does not trust the Soviets . His ideology is completely different." Qaddafi is quick to say he believes his ideology is superior and the only alternative to the communist-capitalist dichotomy.

In Qaddafi's world, there are no political parties, only the people with their 1,400 people's congresses and, behind them watching them, the innumerable revolutionary committees.

To be a member of a party is treason, Tripoli University's revolutionary committee members pointed out last week in interviews. They hanged two students belonging to the fundamentalist Moslem Brotherhood and Islamic Liberation parties in April 1984. The executions were carried out in public on campus. Communists, the committee members suggested, might expect a similar fate.

Qaddafi declines the title of president but he is content to have the followers who enforce his dream call him "prophet" or "the teacher," "the inspirer," or, simply, "an ideal."

Because power is supposed to be the domain of all the people, Qaddafi, who sets the agenda, can claim at once to be responsible for everything and nothing.

This is a principle that carries into foreign affairs.

"We are going to liquidate any person who allies with the Zionists and imperialists," an education student and revolutionary committee member said matter-of-factly last week. This is not a matter of acting on orders, but an article of faith, as he explained it.

So when a Libyan in London fired from the country's embassy into an anti-Qaddafi demonstration in April 1984, killing a British policewoman, he was in a sense only acting on his revolutionary principles.

When Palestinians supported by Qaddafi burst into Rome and Vienna airports to kill as many people as they could, Qaddafi could acknowledge that the act would be illegal if a government committed it. But what the Palestinians do is their responsibility, not his, he says.

For all the displays of public support, many diplomats here believe that most Libyans are growing weary of Qaddafi's revolution. Certainly some factions in Qaddafi's armed forces appear to be tired of it. On at least two occasions in 1985 they reportedly tried to kill the leader. Qaddafi currently is in the process of creating an "armed people" led by the revolutionary committees, to counterbalance the professional military if not to replace it.

"If somebody is successful in doing something to Qaddafi he will have the general support of the population," said a European diplomat, not for attribution, last week.

But other analysts are not so certain.

"The Libyans are very much afraid of these revolutionary committees," said another diplomat. He suggested that they may represent only "a small group of boys who still believe in the revolutionary process, but unfortunately the people of this country, because they are Libyans, because they are Arabs, they do not react. They just follow."

"The colonel goes on," said the diplomat. "I think he is very well protected."