The Egyptian government today expelled Chris Harper, the correspondent here of the American Broadcasting Corp. television network, and gave him 24 hours to leave the country.

His expulsion came after a violent attack yesterday by President Anwar Sadat on Western media, particularly the American, for presenting what he said was a "distorted" image of Egypt and himself abroad, including suggestions that his government was unstable and headed for the same fate as that of the late shah of Iran.

Harper is the first Cairo-based American correspondent -- and only the second Western one -- to be expelled since Sadat came to power 11 years ago this month.

He joined ABC as its Cairo correspondent in January. Before then he had worked for Newsweek in Beirut.

Harper had no comment on the expulsion order except to say that he understood it would have no effect on ABC operations here.

In Washington, ABC president Roone Arledge sent a letter to the Egyptian ambassador protesting "in the strongest possible terms" Egypt's action. ABC also announced that its Paris correspondent, Doreen Kays, will temporarily replace Harper in Cairo.

The action came only a half hour after the State Information Services finished showing to the foreign press corps at the Nile Hilton Hotel a videotape of an interview Harper had done with David Hirst, a British correspondent based in Beirut who is known for his strong anti-Sadat views.

The two rolls of tape were seized by Egyptian authorities at the airport here on July 29, without Harper's knowledge, and replaced by three home videotapes, which were discovered only upon their arrival in New York.

Asked tonight how the government had obtained the tapes, Shafei Abdel Hamid, chairman of the State Information Services, would say only that they had come through a "friendly channel."

The Hirst interview originally was scheduled to be part of a program on Sadat and his government that was to be aired just before or during the visit of the Egyptian leader to the United States in early August.

But ABC had already decided to cancel the program before Harper held his interview with Hirst in Beirut on July 23, and the interview was never shown on American television.

In the interview, Hirst charged that Sadat was basically an "actor" with an "inferiority complex" in regard to his mentor, the late Egyptian president, Gamal Abdel Nasser. He said that while the Egyptian political system under Sadat was "very different" from that of the late shah of Iran, the one here was "just as politically unviable."

Hirst, who writes for the Manchester Guardian and is about to publish a book on Sadat, was once based here but was expelled in 1977 because of his articles attacking the government.

At his press conference for the foreign press corps yesterday, Sadat himself violently attacked several American publications and writers, including U.S. News and World Report, New York Times columnist William Safire, ABC, and the Cairo-based correspondent for the National Broadcasting Corp., Paul Miller.

In a later statement released by the official Middle East News Agency, the State Information Services said the action did not signal a change in attitude toward the foreign press corps.

"The expulsion of the ABC correspondent is a measure involving a specific case and it will not cast a shadow on any other foreign correspondents based here," the statement said.

"President Sadat has assured that there will be no restrictions on the freedom of foreign correspondents based in Egypt and no intervention by the authorities in the fullfilment of their profession."