A federal prosecutor argued in D.C. Superior Court yesterday that it is "perfectly legitimate" for the U.S. government to consider the wishes of a foreign government in deciding whether to pursue charges against demonstrators protesting outside foreign embassies here.

Assistant U.S. Attorney Scott L. Fredericksen made the comment in response to charges that the government was selectively prosecuting 25 clergymen arrested outside the Soviet Embassy while it has declined to prosecute more than 2,000 antiapartheid demonstrators arrested outside the South African Embassy since November.

"Given how closely situated the South African and Soviet embassy demonstrators are," said defense lawyer Matthew Myers during the hearing, it makes one "suspicious of Soviet influence".

The 24 rabbis and a Lutheran minister arrested May 1 were charged with congregating within 500 feet of a foreign embassy. Prosecutor Fredericksen said yesterday that although there is no evidence supporting claims that the government was pressured into prosecuting the rabbis, it was "perfectly legitimate" to take a foreign government's "concerns into account."

Fredericksen did not explain the government's decision to drop charges against those arrested almost daily outside the South African Embassy. But Judge Noel Kramer, in her questions, mentioned three possible reasons for dismissing some charges while prosecuting others.

Kramer noted that the South African Embassy may not want the public forum on its political policies that a trial might offer; that U.S. Embassy personnel in South Africa may not feel as threatened as those in other places, and that the large number of cases of the antiapartheid demonstrators could "strangle" the court system.

In addition to the question of selective prosecution, Kramer is expected to rule in September on the constitutionality of the law that prohibits demonstrations within 500 feet of foreign embassies. Kramer could dismiss the charges or set a trial date.