The Iranian government sued the deposed shah and his wife for $56.5 billion today, claiming that they diverted staggering sums from the nation to their personal use while they were in power.

A legal battle over Iran's wealth also surfaced in West Germany, where Morgan Guaranty Trust Co. said it obtained an order to seize Iranian holdings in German companies to protect the bank's $40 million claim against Iran.

Ayatollah Ruhollah Khomeini has demanded the return of the shah, Mohammad Reza Pahlavi, as well as his fortune, as a condition for ending the takeover of the U.S. Embassy and release of 49 hostages in Tehran. The civil suit filed in Manhattan State Supreme Court is Iran's first attempt to use U.S. courts against the shah.

The shah will make no comment on the suit until the court hears the complaint, according to a press aide, Chris Godek.

The shah was resting comfortably today in New York Hospital-Cornell Medical Center, Godek said, after the apparently successful removal of a gallstone from his bile duct Monday night.

No fragments of the stone were seen in X-rays taken today, a hospital statement said. However, the statement said doctors wanted to continue allowing fluid to drain for a few days from the tube implanted in his bile duct before removal of the tube.

Although the statement was not precise, it appeared to make it unlikely that the shah will receive medical clearance to leave the hospital until the weekend, at the earliest. Doctors said they also want to continue use of antibiotics, which have brought down a fever caused by a bile duct inflammation.

The $56.5 million suit breaks down damages this way:

$20 billion of compensation for funds allegedly diverted by the shah.

$1 billion in punitive damages against the shah.

Compensation of $5 billion for assets allegedly diverted by the empress.

Punitive damages of $500 million against the empress.

$30 billion in recompense for an alleged additional $10 billion in money and property the two are charged with converting to their own use in 1978 and 1979.

The suit against the shah charges that he "misappropriated, embezzled, or otherwise diverted to his own use assets and funds having an approximate value of $20 billion. . . ."

It charges that a plan to enrich himself at the expense of the Iranian government involved establishing several nonprofit foundations, the largest being the Pahlavi Foundation.

The shah set up the Pahlavi Foundation in Tehran in 1958, and by his account eventually gave it the bulk of his wealth. Critics, however, have argued that the shah manipulated the foundation as an investment company.

The suit alleges that the foundation was "created for the purpose of holding the shah's personal wealth." It estimates the value of the foundation's assets during the shah's rule at between $2.5 billion and $3.5 billion.

The shah ordered government bodies to transfer funds secretly to the Pahlavi Foundation for his personal benefit, the suit charges. It cites the National Iranian Oil Co. as an example. The Iranian government, according to the suit, cannot account for "several billion dollars" of oil company revenues between 1973 and 1978, and believes that billions were ere taken secretly by the shah.

The Washington law firm of former senator James Abourezk (D-S.D.) and the New York firm of former City Council president Paul O'dwyer filed the suit. In addition to the massive damages it seeks, the suit asks that, pending an accounting of the shah's property, his assets and those of the Pahlavi and other foundations be put in trust.

The suit includes a three-page appendix of known assets of the Pahlavi Foundation as of December 1977. Among the assets listed are the Fifth Avenue building owned by the separate Pahlavi Foundation of New York and a New Orleans development project.

The shah and his idea have insisted that the New York foundation has always been separate from the Tehran foundation.

The suit claims jurisdiction because the shah and his wife today are residents of New York City, and the Iranian government has business offices in New York.

In the second court action disclosed today, Morgan Guaranty Trust said a West German court order seized the Iranian assets in Friedrich Krupp Co. (believed to be a 25 percent interest) and Iran's reportedly more than 25 percent of the shares of Deutsche Babcock to protect the bank's claim against Iran.