The U.S. Embassy residence in Hungary is an elegant old mansion nestled in the hills overlooking Budapest. But it is not big enough for two ambassadors, and that has confronted the State Department with a ticklish protocol problem.

Earlier this year, R. Mark Palmer, deputy assistant secretary of state for East European affairs, was confirmed as ambassador to Hungary. However, he has not been able to assume his new post because Nicholas Salgo, who has been in Budapest since early 1984, has been reluctant to leave.

Salgo, a Hungarian-born businessman and former managing director of the Watergate complex, wanted to become coordinator of the U.S.-Soviet cultural exchanges agreed to at the Geneva summit last November. But, department sources confided, that idea was vetoed by U.S. Information Agency Director Charles Z. Wick, who ironically rents his Rock Creek Park house from Salgo.

Salgo, who also was rebuffed in an attempt to get the embassy in Vienna, complained that ambassadorial appointments normally are for three years and that he was being recalled prematurely. The State Department, aware that Salgo has a lot of friends in the top reaches of the administration, decided not to argue the point for the time being.

Instead, it chose to employ Palmer profitably in the short term by assigning him to help plan the summit between President Reagan and Soviet leader Mikhail Gorbachev scheduled to take place in the United States this year. However, since the Soviets have been reluctant to set a date, there has not been much opportunity to do any planning.

In the meantime, Thomas W. Simon Jr., scheduled to replace Palmer at State, was given a mark-time assignment to the Foreign Service Institute. But the seminar course he is attending is due to end next month.

The sources said the logjam could be broken Tuesday if departing Soviet Ambassador Anatoliy Dobrynin, who will have a farewell meeting with Reagan, reveals Moscow's views about a summit date. If the Soviets agree to a meeting this summer, the sources said, Palmer will remain here through that time. But if the Soviets remain noncommittal or hold out for a later date, the State Department will have to decide whether it wants the White House to tell Salgo that it is time to start packing.The Company They Keep . . .

Word around town is that the real reason Gray & Co. recently ended its lucrative work as lobbyist for the communist government of Angola had nothing to do with the exuberant young conservatives who staged protests outside its door, or even with the fact that the Reagan White House made a modern-day George Washington out of Angolan rebel leader Jonas Savimbi.

The real reason for the goodbye, it is said, is that the government of Morocco, a monarchy with no great tolerance for African-style Marxism, has just severed its dealings with Gray. Gray is said to be worried that the anti-Soviet Turks may soon do the same.