Though rarely proclaimed publicly, the use of diplomatic titles to protect intelligence officers in foreign countries has long been standard practice for the United States -- and for the Soviet Union, Israel, Britain, France, West Germany and probably every country that maintains an intelligence service.

U.S. officials dismiss as irrelevant accusations by Iranian radicals that the American Embassy in Tehran was a "nest of espionage." In the views of these officials, no such accusations justify a blatant violation of international law -- the arbitrary detention of persons with diplomatic immunity.

An intelligence officer assigned to an embassy and given formal diplomatic status enjoys the full benefits of diplomatic immunity, according to traditional diplomatic practice.

The stationing of Central Intelligence Agency employes with diplomatic titles in American embassies has been discussed openly for years. In 1974 The Washington Monthly published an article called "How to Spot a Spook" in which John Marks explained how CIA employes with diplomatic cover could be identified in open State Department directories.

The directories Marks cited have not been published since then. However, CIA agents apparently continue to carry the most telltale designation Marks described, an FSR (foreign service reserve officer) rank instead of the standard FSO (foreign service officer) tag carried by ordinary State Department diplomats.

The cable released by Iranian students Saturday in which the U.S. charge d'affaires in Tehran appeared to acknowledge the presence of two CIA men in the embassy included a reference to this telltale "r" as "the old and apparently insoluble problem of r designation" for CIA employes.

Knowledgeeable sources report that the CIA regards diplomatic cover as the best possible protection for its operatives abroad, and has long struggled in Washington to maximize the number of diplomatic slots allocated to agency employes.

The present ratio of ordinary diplomats to CIA employes in foreign missions is not publicly known, but informed sources said the division was the subject of a formal 1977 agreement between Secretary of State Cyrus R. Vance and the president's national security affairs adviser, Zbigniew Brzezinsksi.

Several sources pointed out that intelligence work covers a myriad of activities, including much information-gathering that is essentially the same as normal diplomatic reporting. "Every CIA employe is decidedly not a James Bond," one source said.

"Espionage" can mean counting the number of trucks that cross a particular bridge as well a opening the prime minister's mail, one source noted.

If a host country is displeased by a diplomat's behavior, the remedy is to expel the diplomat, a State Department official said. Expulsion has been used by dozens of governments around the world, most often in recent years against Soviet diplomats, but against American and others as well.

In 1978 the United States expelled a Soviet diplomat at the United nations, Vladimir P. Zinyakin, after implicating him in a spy operation that involved two other Soviet citizens who did not have diplomatic status. Those two, Rudolf F. Chernyayev and Vladik A. Enger, were tried and sentenced to long prison terms before being swapped to the Soviet Union this year for a group of dissidents.

In 1971 the British government expelled 105 Soviet nationals, most of them diplomats, after charging them with improper espionage activity. The Soviets also have followed this pattern when they have caught western spies with diplomatic status on their territory.

Several official sources say it was sloppy of the embassy in Tehran to keep on file copies of a telegram referring directly to a CIA presence in the embassy. One source close to the intelligence community also expressed surprise that the CIA apparently had been eager to put new agents into the Tehran embassy last summer, given the sensitivity of the situation there. Other sources said the agency was just doing its job.

A number of past and present foreign service officers said in interviews that the American personnel in embassies abroad invariably know who among them is working for the CIA. In some capitals the name of the station chief, or senior CIA official in the embassy, is common public knowledge.

Most embassy staffs also include military attaches, one of whose undisguised functions is to gather information on the military establishment of their host country.