The White House refers to it grandiosely as "the week of Panama." But one harassed State Department official says it really should be called "the week of pandemonium."

They're talking about the scene this week when the hemisphere's top leaders gather here for Wednesday's signing of the historic and controversial treaties that will transfer U.S. control over the Panama Canal to Panama.

When President Carter and Panama's ruling strongman. Gen. Omar Torrijos, put their signatures on the treaties, the preisents or prime ministreaties, the presidents or prime ministers of at least 19 countries, covering a geographic range from Canada to Argentina, will be standing at their elbows.

It will be the biggest gathering of statesmen to hit Washington since the 1963 funeral of President Kennedy. And, depending on where one stands in the hierarehy of government, it will mean either five days of high-level diplomacy mixed with glittering social ceremony or five days of frenzied, bone-wearying work.

For Carter and the top members of his foreign policy team, the treaty signing and its attendant ceremonies will mark the first major milestone of their fledgling administration.

In addition to turning over a new page in the history books, this week's events will give Carter the chance for private, face-to-face talks with almost all of his hemispheric counterparts.

The presence of the governmental leaders - plus lesser-ranking representatives from at least five other countries - will also give Carter the opportunity to demonstrate to the Senate the unanimous support that the nations of Latin America give to approval of the treaties.

That is a matter of no small importance to the Carter administration, which faces a battle in getting Senate approval of the treaties. To make sure the senators are aware of how the rest of the hemisphere feels, the administration has invited all 100 senators to be present at the signing.

It's a scenario that has been written for maximum symbolic effect. To get it on stage and unfolding in a way that will "play" before its intended audience, a small army of State Department and White House officials has been working around the clock for the past several days.

This force, known as The Panama Working Group, has been concerned with everything from preparing the position papers for Carter's talk with his visitors to ensuring that they have sufficient cars to get them around town. It has had to deal with problem as potentially serious as the posibility of demonstrations and as socially vexing as who's coming to dinner at the White House after the signing ceremony.

The latter problem was no small matter since the White House dining rooms aren't big enough to accommodate the cast of hundreds who will be on hand. It was solved by scheduling the White House dinner for governmental heads only, while Secretary of State Cyrus R. Vance simultaneously entertains everyone of lesser rank at another dinner at the State Department.

Inevitably, the biggest problems have involved sorting out the large and not entirely harmonious group of visitors - ranging from dictators to democrats - in ways that will not results in raffled feelings, diplomatic incidents or domestic political problems.

One discordant note, for example, was sounded by news that Mexican President Jose Lopez Portillo, a leader who has been courted with particular care by Carter, will not attend the ceremonies. That led to speculation that Lopez Portillo was dissatisfied with the treaties, angered by U.S. proposals to clamp down on illegal immigrants from Mexico and unwilling to appear in the company of Chile's military ruler, Gen. Augusto Pinochet.

After these points were made in a dispatch from Mexico City published by The Washington Post on Friday. White House and State Department sources immediately rushed to make clear that Carter and Lopez Portillo had talked by telephone and that the Mexican president had been "warm and positive" in his attitude toward the canal treaties and the United States.

Similarly, Mexican Foreign Minister Santiago Roal, who will represent Lopez Portillo at the ceremonies, issued a statement denying any friction. He said Lopez Portillo was not coming only because of important, previously scheduled budget and planning meetings to deal with Mexico's severe internal economic crisis.

There also have been one or two other slightly sour notes. Brazilian President Ernesto Geisel sent his regrets because the signing ceremony is scheduled for the same date as Brazil's national day. That resulted from an unforeseen coincidence. U.S. sources say, but some press organs in Brazil reportedly have leaped to the conclusion that a deliberate slight was intended.

Nor have the only ripples been caused by those who aren't coming. There are a large number of exiles from Latin America's turbulent politics in the United States: and they, together with their U.S. supporters, are likely to attempt demonstrations against the presence of such authoritarian leaders as Paraguay's Alfredo Stroessner and Panama's Torrijos.

The biggest concern about possible demonstrations centers, though, on Chile's Pinochet, who has been the main target of hemispheric liberals ever since the 1973 overthrow of Socialist President Salvador Allende. Since then, the Pinochet regime has been accused of wide-scale repression, torture and imprisonment of its opponents.

Some Carter supporters have expressed concern that entertaining Pinochet and other Latin dictators might seem to be giving them a U.S. stamp of approval. However, administration sources insist that they were invited because their countries are part of the hemisphere and could not properly be excluded.

In addition, the sources added, when the ceremonial clinking of champagne glasses is over and the visitors get down to their private talks with Carter, the President intends to raise "some very hard points" about the human rights situation "in Chile and any other country where such a problem exists.