A federal judge ordered the director of the National Gallery of Art yesterday to take custody of five pieces of sculpture and a painting owned by Iran -- valued all together at more than $1 million -- until a lawsuit brought against Iran by seven American insurance companies is resolved.

The painting, entitled "Woman Three" by Willen de Kooning, a a Dutch-born American artist, and a series of five sculptures, called "La Deputation" by French sculptor Jean Dubuffet, have been on loan to the gallery from the Tehran Museum of Contemporary Art and we are now in storage.

Lawyers for the American insurers had asked U.S. District Court Judge George L. Hart Jr. to prevent the removal of the art works because they are Iranian assets that could be used as compensation in conncetion with the insurers lawsuit.

The insurers suit against the Islamie Republic of Iran and Central Insurance of Iran contended that the Iranian government's nationalization of American insurance interests last June was illegal.

In court papers, the insurers charged that the action by the Iranian goernment under its religious and political leader, the Ayatollah Ruhollah Khomeini, violated a 1955 economic relations treaty between the United States and Iran. The insurers said they have received no compensation for losses as a result of the nationalization. They said the losses total more than $34 million according to court records.

Yesterday, Hart issued a brief order putting the art work in the custody of the gallery director until the dispute is resolved in the courts. Spokesmen for the gallery could not be reached immediately for comment last night.

It has been reported that the works on loan to the gallery were due back in Tehran last January. Officials at the gallery, and two other American museums which received Iranian-owned works on loan, cited shipping problems as the cause of the delay. The other museums are the Guggenheim Museum in New York and the Herbert F. Johnson Museum in Ithaca, N. Y.

The works, loaned to the American museums in 1977 and 1978, included contemporary Western art collected during the regime of the deposed shah, according to earlier published reports.

J. Carter Brown, the director of the National Gallery, recently expressed concern about whether the museum was free to return the works to Iran. He was quoted as citing President Carter's executive order prohibiting the return of Iranian property in the United States.

The artist de Kooning has been described as a powerful influence among avant-garde painters in the mid-1940s. His abstract paintings and collages later established him as a major contemporary artist. The "Woman Three" painting at the National Gallery is part of a widely noted series called "Woman," finished from 1952 to 1955, Dubuffet's style has been described as "raw art," sometimes based on compositions made from ashes, sand and cinders joined by a thick varnish. The French title of his work at the Gallery, "La Deputation" means "the delegation." Lawyers for the insurers went to the gallery late yesterday and served an official there with a copy of Hart'sorder. The insurance companies are American International Group Inc., The Continental Corp., INAcorp., American International Reinsurance Co. Ltd., American International Underwriters Overseas Ltd., American Life Insurance Co. and The underwriters Bank Inc., according to court records.

Attorneys for Iran Central Insurance of Iran are expected to appeal Hart's ruling.