Just moments before a celebrity-studded "show trial" was to get under way, a municipal prosecutor announced today he would not prosecute charges of criminal trespassing against 12 antiapartheid demonstrators arrested here for protesting the sale of gold coins minted in South Africa.

The demonstrators, including a Nobel Prize-winning scientist and several well-known local politicians, said they were disappointed at not getting their day in court and immediately announced plans to resume protesting Tuesday.

The trial, which would have been the first of its kind since nationwide protests against South Africa began last November, had been sought by protest organizers as a way of focusing attention on South Africa's policies of racial domination of its majority black population. Such a courtroom forum has eluded demonstrators at the South African Embassy in Washington because the U.S. attorney's office there has declined to prosecute them.

Defense attorneys in Boston had lined up singer Harry Belafonte, former tennis star Arthur Ashe and at least one member of Congress who were expected to testify that conditions in South Africa warranted acts of civil disobedience.

But an anticipated three-day examination of apartheid ended in 10 minutes when John Gibbons, assistant district attorney for Suffolk County, which had jurisdiction in the case, walked into Boston Municipal Court and told the judge his office had decided not to prosecute the defendants and moved to dismiss the charges.

"The issues my brothers and sisters have indicated they want to raise are serious issues, but I suggest this is not the forum," Gibbons said. He told Judge Charles Grabau that a three- to four-day jury trial would not be in the "best interests" of Boston's taxpayers.

The protesters were arrested in December and January after they refused to leave the downtown offices of Deak-Perera, a New York-based dealer in coins and precious metals whose business includes the sale of South African krugerrands.

Defense attorneys had planned to argue that it was "necessary" to break the law because of the "imminent danger" South Africa's apartheid policies pose in the nation.

In Washington, Randall Robinson, coordinator of nationwide protests that have resulted in the arrests of more than 1,700 persons, said leaders of the Free South Africa Movement ement still hope the demonstrations will end up in the courtroom. The "disinclination to debate any of these issues publicly is as clear an indication as one could expect that defenders of apartheid think their positions are indefensible," he said.

Among those whose charges were dismissed were George Wald, 78-year-old Nobel laureate in biology; Melvin King, a former Boston mayoral candidate and two Boston city councilors.