Waldermar John Gallman, 81, a U.S. ambassador to three nations and the director general of the Foreign Service from 1958 to 1961, died Saturday at his home in Washington after a heart attack.

Mr. Gallman was a career Foreign Service officier. He served as ambassador to Poland from 1948 to 1950, to South Africa from 1951 to 1953, and to Iraq from 1954 to 1958.

He began his 38-year diplomatic career as secretary at the U.S. Embassy in Havana, Cuba. He later served elsewhere in Latin America and in Eastern Europe before being named consul in the free city of Danzig in 1935. e

From 1938 to 1942, he was assistant chief of the State Department's European affairs division. He then served at the U.S. Embassy in London as first secretary and deputy chief of mission until he was named ambassador to Poland.

After retiring from the Foreign Service in 1961, he spent the next nine years as a consultant to the governments of South Korea and Vietnam. He helped those countries establish diplomatic training programs for their foreign services.

Mr. Gallman was a native of Wellsville, N.Y., and a 1921 graduate of Cornell University. He also attended Georgetown University's law school.

He was the author of "Iraq Under General Nuri," published by Johns Hopkins University Press in 1964.

He was a member of All Souls' Unitarian Church in Washington, the Columbia Historical Society, the Cosmos Club, and DACOR (Diplomatic and Consular Officiers, Retired).

His wife, Marjorie, died in 1973. Survivors include two sons, John G., of Bloomington, Ind., and Philip G., of Burke, Va.

The family suggests that expressions of sympathy be in the form of contributions to the scholarship fund of the American Foreign Service Association in Washington.