U.S. Attorney Joseph E. diGenova said yesterday he will press charges against 28 abortion protesters arrested Tuesday on the steps of the Supreme Court.

The action, which contrasts with diGenova's decision not to prosecute any of the apartheid demonstrators who are arrested on an almost daily basis outside the South African embassy here, drew sharp criticism from abortion opponents that the law is being applied unfairly.

"I am deeply distressed, bordering on outrage," said Jack Willke, president of the National Right to Life group. "To prosecute them is to persecute them, and that is not equal justice under the law."

DiGenova issued a terse statement yesterday about his decision to prosecute the abortion protesters, but it offered no explanation for his reasoning.

"Because the cases of those arrested Tuesday for illegally demonstrating on the grounds of the Supreme Court are presently before the Superior Court for the District of Columbia, we will not comment on them in any way," diGenova said in the statement.

When diGenova decided last month not to prosecute the apartheid demonstrators, he said the ongoing arrests at the South African embassy lacked "prosecutive merit."

DiGenova's decision to prosecute the abortion protesters was criticized yesterday by leaders of TransAfrica, which has sponsored the protests outside the South African embassy and has claimed the Reagan administration purposely denied the group an opportunity to press its cause in court by dropping arrest charges.

"This certainly indicates the way the two acts are viewed by the attorney general and the Reagan administration," said David Scott, a TransAfrica spokesman.

"The Reagan administration is known to be supportive of the antiabortion protesters," Scott said. "This is granting them and the issue the kind of public exposure that goes along with the charges."

Tuesday's abortion protest and the continuing demonstrations outside the South African embassy are similar in some respects. Both have been orderly and peaceful. The charge brought against those arested outside the embassy -- illegally congregating within 500 feet of a foreign embassy -- carries the same maximum penalty of a $100 fine and 60 days in jail as the charge brought against the abortion protesters -- violating a federal statute prohibiting demonstrations on Supreme Court grounds.

In November, sources close to the U.S. attorney's office cited the peacefulness of the embassy demonstrations as one reason not to prosecute the cases.

DiGenova did not want to "clog" the courts with those cases, sources said, and Justice Department officials believed the city's judges would be sympathetic to the demonstrators' cause.

The concerns raised by diGenova have not stopped prosecutors in other cities from pressing charges against other demonstrators involved in the nationwide protests against South Africa.

"We prosecute any individual whom the police arrest," said Paul Leary, first assistant to the district attorney in Boston, where several persons were arrested during a protest outside a gold exchange selling South African krugerrands.

"I think that the issues raised in the two cases are identical," said John Cavanaugh-O'Keefe of Human Life International, based in Washington. "It's tempting to raise a legal issue over it. Either they're going to enforce the law or they're not. It's straightforward discrimination."

On Tuesday, tens of thousands of abortion opponents gathered to mark the 12th anniversary of the controversial Supreme Court decision legalizing abortion. The president spoke to them in support of their cause through a telephone hookup from the Oval Office.

Demonstrators marched from the Ellipse to the Supreme Court. There, 28 adults and one juvenile knelt on the steps, refused to disperse and were arrested.

Seven of the demonstrators were released by police on citations to appear in court next week. Twenty-one were held overnight in jail and appeared yesterday in Superior Court for arraignment, where 17 said they would plead guilty and four vowed to go to trial.

All were later released on their personal recognizance pending future court dates.

The 29th person was not accounted for.

"I don't feel that I did anything wrong to walk up the steps of the Supreme Court to pray for babies the court says can be murdered," said Margaret J. Caponi, a 58-year-old housewife from Havertown, Pa., who pleaded not guilty. "If they feel we violated one of their ordinances, then I'm willing to go to trial to explain my side of it," she said.

Nanette Falkenberg, executive director of the National Abortion Rights Action League, hailed diGenova's decision to prosecute the protesters.

"I think the more the message goes out that if you're going to protest on abortion rights you're going to protest within the law . . . and that if you go outside the law you're going to be prosecuted, the better," she said.