Spain's El Pais newspaper said yesterday that two U.S. Embassy officials expelled from Spain earlier this month in connection with espionage activities had been caught photographing communications antennae on the roof of the prime minister's residence.

A front-page report identified the officials as Dennis E. McMahan and John F. Massey. Quoting Spanish Interior Ministry and diplomatic sources, the report said the two had been photographing the antennae from a museum building near the prime minister's residence on the outskirts of Madrid.

Spokesmen for the U.S. Embassy and the Spanish Foreign Ministry refused to comment on the newspaper account, Washington Post special correspondent Tom Burns reported.

A ministry protocol list said McMahan joined the embassy as a second secretary attached to the political section in February 1984. A secretary in the section said McMahan had been evacuated to the United States three weeks ago for medical reasons. Spanish press reports said Massey served in a civilian capacity at the joint Spanish-U.S. Torrejon air base near Madrid.

Independent security sources said they considered it unlikely that officials using diplomatic cover would have exposed themselves in such a manner and speculated that the two had been involved in other activities that irritated Spanish officials.