Shortly before noon last Monday, the man who has ruled this country for nearly 12 years was just waking up. Barefoot and bath-robed, he padded into the kitchen, acknowledged greetings of "Buenos dias, Omar," from the maids and children, and poured himself a glass of orange juice.

A secretary squirted some drops into his perpetually reddened eyes, and Gen. Omar Torrijos sat down to plan his day.

Three months after it began, Torrijos' latest filing with international notoriety was over. The day before, Mohammad Reza Pahlavi, the dethroned shah of Iran, had left Panama for Egypt, fleeing a fight over who would operate on his enlarged spleen, and fearing, despite Torrijos' constant assurances to the contrary, that Panama intended to allow his extradition to Iran.

In the wake of Pahlavi's departure, the most exciting thing going on in Panama that morning was the government-decreed increase in prices for bread and cement, sure to cause a popular backlash that would mean nothing but headaches for Torrijos.

Since ostensibly turning power over to a civilian president nearly 18 months ago, Torrijos had displayed little interest in domestic matters, preferring to occupy his time with more pressing foreign policy concerns, such as the ousted shah.

Although he referred to Pahlavi's flight as "this strange business," Torrijos, all in all, had come out of the crisis unscathed and seemed pleased. t Iran was mad at the United States, but had taken pains to reassure Panama of its friendship. The United States was upset with both Iran and Pahlavi, but seemed well pleased with Torrijos for having cooperated over Pahlavi while he could.

A restless man, who often moves among his four principal Panamanian residences several times a week, Torrijos decided to head that night for the beach, to his Pacific retreat at Farallon. In two days, he would leave for a Latin American political meeting in the Dominican Republic. By the weekend, he would be en route to Europe, and was thinking he might stop over a day or so in New York.

The past weekend in Panama had been part international crisis and part "circus," in the description of one Iranian government representative who lived through it.

When the dust of four days of hectic negotiations and panic had settled, one of the few things certain was that Pahlavi was gone, along with his wife, his security guards, his aides and his two very large dogs.

The former shah's departure appeared to leave everyone here feeling a bit deflated, and it ultimately raised more questions and problems than it resolved.

Speaking "from the shah's chair," alone in the house he had loaned the deposed monarch on Contadora Island, Panamanian attorney and former diplomat Gabriel Lewis told friends by telephone Monday that the place was a mess -- furniture ruined and drapes torn, dark and dirty.

One Panamanian official, when asked about rumors Pahlavi had invested large sums of money here in exchange for his three-months asylum, rolled his eyes in disgust.

"Are you kidding?" he asked. "All he left here was a lot of dog s---."

Sunday morning, barely two hours before Pahlavi took off for Cairo in a chartered plane, Christian Bourguet still hoped the flight could be cancelled.

He paced his room at the modest El Continental Hotel here, twisting his long, rosary-like string of worry beads around and around his fingers, stopping only to occasionally run a hand through his wild, coal-black hair.

Bourguet, one of a group of French attorneys who had long worked in Paris with the Iranian exile movement during the shah's reign, had been one of the intellectual godfathers of the extradition plan. It was designed as a way either to send Pahlavi back to Iran, or to arrange some sort of tribunal here in Panama that would provide a forum for airing Iran's charges against him.

Bourguet had worked steadily on the plan for three months, even while an ostensibly separate United Nations commission was attempting to negotiate release of the hostages without giving in to Iran's demand that Pahlavi be delivered.

Now, as he was within a day of turning over to Panama the documentation needed to support Iran's extradition request, the whole thing was falling apart.

With Bourguet were two Iranian prosecutors and Farouk Parsi, legal counsel at Iran's mission to the United Nations, a man as calm and composed as Bourguet was tense and harried.

The two men moved between the rooms of their suite, one talking to a reporter, the other shouting in French, Persian, Spanish or English over the telephone.

Bourguet was still trying to buy time, tyring to persuade Torrijos and White House Chief of Staff Hamilton Jordan to keep Pahlavi from leaving Panama, in exchange for movement of the hostage question -- ideally for the United States, the transfer of the hostages from the control of Tehran militants to the custody of the Iranian government.

Following conversations with Iranian Foreign Minister Sadegh Ghotbzadeh, Bourguet asked Panamanian and American officials for a few more hours past the 24-hour deadline that they had set the day before.It was due to expire at noon.

The answer was no.

Frantic telephone calls continued, until shortly before 2 p.m., when Bourguet put down the telephone and sat for once on the edge of the bed with the beads still in his hands. The shah was gone.

"Do you want to eat something?" Parsi asked Bourguet.

"No, I can't eat."

The reporter asked, "Do you want to talk."

"No I can't," Bourguet shook his head.

They spent the next several hours trying in vain to persuade the United States to turn back the plane when it stopped in the Azores for refueling, promising imminent action on the hostages that never came to pass.

When Hamilton Jordan headed for Panama last week, he was armed with the knowledge that Pahlavi had quietly made plans to leave there for Egypt. At the same time, the Carter administration believed this was largely because he feared Panama would not allow him to be operated on by U.S. surgeons recommended by his American friends.

Jordan went quickly to confer with Torrijos, with whom he had become friendly during negotiations and ratification of the Panama Canal treaties. Torrijos quickly assured him Pahlavi could have whatever doctors he wanted.

The question of who would operate on Pahlavi, and where, had become a central issue nearly two weeks before. Surrounded by his wife, his sister Princess Ashraf and aides, Pahlavi had entered Paitilla medical clinic, presumably to have his spleen removed. At that point, simmering animosities between Panamanian and U.S. physicians and government officials broke into the open.

The former shah and his friends and relatives wanted the surgery performed by Houston surgeon Michael DeBakey, and they wanted it done at Gorgas Hospital, a U.S. military installation in Panama.

Panamanian doctors who had been treating Pahlavi were insulted, and their government, which originally had agreed to go along with whatever the former shah wanted, backed them up and refused to grant DeBakey a temporary license to operate.

The Panamanian reaction, however, formed only a minor part of U.S. reluctance to let Pahlavi use a U.S. facility. More important was the fear that Iran might then take reprisals against the hostages.

Reportedly frightened by the conflicts, Pahlavi and his entourage packed up and left the Paitilla clinic after two days.

When White House Counsel Lloyd Cutler and Arnold Raphel, a special assisant to Secretary of State Cyrus Vance, visited Pahlavi on Contadora Island that Friday night, it quickly became apparent that the deposed shah could not care less who would perform the operation and at which hospital in Panama. He was going to Cairo.

"It was all a pretty useless trip," said one U.S. official. "I couldn't figure out why we were there."

One reason was to answer a possible request from Pahlavi to come to the United States for medical treatment. U.S. officials insisted they had prepared an answer for just such a question, but that it was never asked. They later refused to say what the answer would have been.

On Sunday, when Pahlavi was already on route to Cairo, various U.S. officials claimed it had been understood that he could have come back to the United States if he had wanted to.

His lightning departure in fact had been facilitated by the United States when Cutler arranged through a friend to have a private plane chartered after Egyptian Preisdent Anwar Sadat said an aircraft he planned to send would be delayed as much as three or four days.

With his mission to talk to the shah completed, Cutler left Panama Saturday night. Jordan and Raphel left for Washington within an hour of the shah's departure.

By Monday, Panamanian officials were charging that the entire departure had been forced by what they said were "agents" of former secretary of state Henry Kissinger and David Rockefeller -- who, they said, were "friends" of the shah who wanted to embarrass the United States.

Kissinger said he had done no such thing.

On Monday morning, Bourguet sat uncomfortably on a sofa in the basement of the Panamanian Foreign Ministry, seemingly oblivious both to the dangling cigarette burning dangerously close to his moustache and the crowd of reporters in the small, stuffy room.

The reporters were questioning Iran's Panamanian lawyer, Juan Materno Vasquez, who had just officially presented Iran's case for extradition of Pahlavi on charges of torture, murder theft and embezzlement.

Vasquez was angry -- not only had the ousted shah fled the country the day before, but the vice foreign minister, expected to officially receive the extradition papers, had left the ministry just minutes before Bourguet, Vasquez and three Iranians had arrived.

"This is an outrage," Vasquez shouted. "This is rudeness. I am a taxpayer in this country." He handed a document to a secretary, who accepted with an embarrassed smile.

The "circus," as Bourguet called it, moved back out to the front sidewalk and, as he and the Iranians climbed into the car, Vasquez turned to the television cameras once again.

Outside, as he and the Iranians were climbing into a car, a reporter pointed out that the time was 10:45 a.m. Hadn't they arrived late for their 10 a.m. appointment with the vice minister?

"We weren't late, Vasquez retorted. He began an elaborate explanation of how one tells time -- "juridical time" -- in Panama.

"Everyone here knows," he said, "especially lawyers, and the vice minister is a lawyer, that 10 o'clock means 11 o'clock, that when you have an appointment at 10, you have until 11 to get there."