The publisher of a Washington-based magazine that has exposed the names of hundreds of CIA officers working abroad defended the practice yesterday on grounds that the CIA is still carrying out "dirty tricks" in foreign countries.

William H. Schaap, publisher of the Covert Action Information Bulletin, protested that legislation to outlaw the identication of U. S. intelligence operatives would make it virtually impossible to expose illegal or improper activities conducted in the name of national security.

Testifying before the House Intelligence Committee, Schaap acknowledged that his publication's persistent attacks on the CIA might not be popular, but he contended that they are sincerely based and ought to be constitutionally protected.

"Patriotism is to some extent in the eyes of the beholder," he said.

Schaap testified, "Our aim is to stop what they are doing today. I'm sure there are politicians being paid off by CIA representatives right now. I'm sure there are elections being bought right now by our CIA."

The CIA is seeking a new law that would make it a crime to disclose, directly or indirectly, the names of its officers, agents or sources abroad, even if the information is obtained from public sources.

Former CIA director William E. Colby, who also testified yesterday, urged passage of the bill as "a major step forward for the protection of individuals who serve our intelligence community." He said American intelligence officers abroad have become increasingly vulnerable in recent years, partly as a result of the transparency of their diplomatic status or "cover" and party as a result of "unauthorized revelations" by former colleagues and publications seeking to destroy the agency.

The CIA contends the bill is vitally needed to maintain its effectiveness, but other witnesses, including a Justice Department spokesman, said at an opening hearing Wednesday that the bill seems unconstitutional because it would lay down criminal penalities for the use of unclassified as well as classified information.

In his testimony, Schaap denounced as a "myth" the notion that naming the names of CIA operatives -- a regular feature of his and similar publications -- subjects them to the danger of physical harm or death.

"Of the more than 1,000 CIA people who have been named over the past five of six years by many people and many publications in many countries, not one has been physically harmed on account of it," he declared.

Colby contended that publication of the name of Richard Welch, CIA station chief in Athens, was a factor in Welch's assassination in December 1975, but he allowed that there were other reasons, such as the weak "cover" Welch had as an American diplomat.

Schaap, however, asserted, and said the CIA knew, that Welch "was murdered by people who were origially stalking his predecessor and had nothing to do with his having been named many times" -- in publications as far back as 1968 -- as a CIA officer in both South America and Europe.

The publisher also declared that the magazine's identification of CIA operatives come not from inside informants but from dozens of public sources and research as uncomplicated as a telephone call to, say, a U.S. embassy.

The CIA bill is part of a concerted effort, partly White House sponsored, to unleash the agency from the restraints of congressional investigations and public criticism that have kept it in the spotlight since the mid-1970s.

Civil liberties groups are preparing a concerted campaign to preserve these controls. At a press briefing yesterday, two American Civil Liberties Union spokesmen, Morton Halperin and Jerry Berman, questioned President Carter's assertion, in his State of the Union message last week, that "unwarranted restraints" have been placed on "our ability to collect intelligence."

"Congress has not passed a single restriction on intelligence gathering," Halperin said. He also challenged the administration's plans to limit its reporting of covert operations, saying the new law being sought here would simply "codify" the fact that it is not reporting all such activities now.