Nicholas W. Panagakos, 55, who had served as NASA's public affairs officer for space science since 1971, died of a heart attack Sunday at a hospital in Portland, Maine.

Mr. Panagakos, who lived in Glenn Dale, Md., was visiting family for the holidays when he was stricken.

At NASA, he was responsible for all public affairs activities concerning this country's space science program and twice received NASA's Exceptional Service Medal. He was awarded the medal last year for his work during the Viking explorations of Mars and received his second medal earlier this year for his role in reporting activities associated with the Voyager encounter with Jupiter and the Pioneer probes to Venus.

Mr. Panagakos joined NASA in 1962 and worked for eight years as the principal information officer for the Goddard Institution for Space Studies in New York.

Before that, he was science editor for the Boston Herald and a documentary science writer for M-G-M in New York.

During the 1968 presidential campaign, Mr. Pangakos was a speech writer for Sen. Edmund S. Muskie (D-Maine), then the Democratic vice presidential candidate. He worked for Gannett Newspapers from 1953 to 1960.

Mr. Pangakos was born in Portland, Maine. He graduated from Harvard University and studied for a masters degree at Boston University. In 1960-61, he was a Sloan-Rockefeller Fellow in Advanced Science Writing at Columbia University's Graduate School of Journalism.

Survivors include a sister, Rita Doukas, and four brothers, Krist, Petros, Peter and Charles, all of Portland, Maine.