President Hosni Mubarak was forced to postpone for almost two hours a visit to the charred wreckage of luxury hotels burned during this week's security police rampage when a few remaining mutineers in a garrison near the Pyramids opened fire on the troops surrounding them shortly before his scheduled arrival.

The shooting was over in minutes when the Army stormed the mutineers' hideout inside their old garrison. The only other pocket of resistance reported in the city was the Hokstad barracks near the airport, where police conscripts were in control of an ammunition dump. Tonight, it was ringed with tanks, their heavy guns trained point-blank on the exits to the installation.

About 40 persons are reported to have died in the mutiny, which began Tuesday night. Property damage is estimated in the hundreds of millions of dollars.

Earlier in the day, Mubarak began what many observers expect to be a major reorganization of his rebellious security apparatus by firing Interior Minister Ahmed Rushdi and replacing him with the 62-year-old police major general, Zaki Badr.

Since late 1982, Badr has been governor of troubled Assyut Province, where frictions between Islamic fundamentalists and a large Coptic Christian population are common. The province was the scene of a major fundamentalist uprising following president Anwar Sadat's 1981 assassination.

The Assyut security police barracks was the scene of violence again this week as mutineers there reportedly attacked a cement factory, a rice warehouse and the transport authority. Diplomats reported two persons killed in the incidents, including a prominent lawyer.

But Badr has a reputation for toughness and is expected by diplomats to begin immediately reshaping the forces now under his command and improving their living conditions.

Increasingly, Egyptians are tending to see the mutiny in stark terms, more akin to a prison uprising by the beleaguered conscripts than a political challenge to the Mubarak administration.

Several security policemen, reassigned to their posts outside embassies today but no longer carrying weapons, told reporters that their officers informed them at the beginning of the week that they would be required to serve a year longer than they had anticipated. The government said after the riots began that this was merely a rumor.

Mohammed Abdel Qadoos, a journalist and prominent member of the influential Moslem Brotherhood, denied today that fundamentalists played any role in the uprising. The leader of his organization, Omar Tamazani, had sent a letter to Mubarak deploring the violence, Qadoos said.

The police conscripts, he noted, "are extremely poor, and next door to them the hotels are filled with millionaires and parties. It's natural for this to happen."

A U.S. diplomat briefing reporters today made much the same observation. The attack on tourist installations near the Pyramids was less antiwestern, he suggested, than a case of "look at my life, look at this life."

Government figures for the number of central security police range from 120,000 to 300,000. Earning only about $4 a month, many of the mutineers were living in tents in their barracks within sight of the opulent hotels they burned.

Yet, the extent of the violence, which hit several smaller Egyptian cities as well as many other security police barracks scattered around Cairo within a matter of hours Tuesday night, still has many foreign observers and government officials worried about the possibility that a broader conspiracy existed.

The concerns are heightened because both the Egyptian government and U.S. officials appear to have been completely surprised by the rampage.

Asked whether he would have said a week ago that such a mutiny was likely, the U.S. diplomat briefing reporters today replied, "Absolutely not."

"You can't rule out that there may have been more behind it than a rumor," he added at another point, estimating that as many as 8,000 to 10,000 conscripts were involved, although only about 2,500 actually have been arrested. But no single group appears as yet to have become the focus of suspicion.

Meanwhile, Cairo is rapidly returning from crisis to normalcy. Today, the Moslem sabbath, the all-day curfew was lifted from 9 a.m. to 3 p.m. and the streets quickly filled with traffic. It was to be lifted for 12 hours on Saturday.