Daniel J. Meloy, 52, a former Foreign Service officer and resident of Washington, died of a heart attack Friday while swimming off the coast of Yucatan.

He was the brother of the late Francis E. Meloy Jr., who was kidnaped and murdered last June while serving as U.S. ambassador to Lebanon.

Daniel Meloy had joined the Foreign Service in 1949. He was a specialist in Japanese affairs and spent much of his career in Japan with intermittent assignments at the State Department here.

He had left the Foreign Service recently. At the time of his death was consultant for a Japanese Bank in New York and other Japanese and American firms.

Born in Washington, Mr. Mely was a graduate of Woodrow Wilson High School and Obelin College. He later studied at Harvard Business School, the University of Colorado, George Washington University and the University of Paris.

During World War II, he served as a Lieutenant with the Navy in the Pacific. He was present at the surrender of Japan and was attached to Gen. MacArthur's staff during the early part of the occupation of Japan.

Mr. Meloy then worked for the State Department and the Central Intelligence Agency.

There are no immediate survivors.