A federal judge dismissed all charges yesterday against 38 White House demonstrators, ruling that the government had violated their rights by "upping the ante" with a second charge after they refused to plead guilty to the original charge against them.

The ruling by U.S. District Court Chief Judge Aubrey E. Robinson Jr. rejected as unconstitutional what both government and defense lawyers said is a common practice by prosecutors here in handling cases involving political demonstrators. Its significance, however, was uncertain.

Under court rules, Robinson's ruling is not binding on other judges, but defense attorneys said they expect to cite the ruling in other cases and hope it will be widely applied.

U.S. Attorney Joseph E. diGenova said no decision has been made yet on whether to appeal the ruling to the U.S. Court of Appeals here, whose decisions are binding on local District Court judges.

The decision came in a case involving demonstrators arrested in front of the White House on April 22 where they blocked entrances and taped messages to the iron fence.

The White House protest was part of four days of demonstrations called April Actions for Peace, Jobs, and Justice. It was sponsored by a coalition of antiadministration groups whose causes ranged from the nuclear freeze to job creation to opposition to U.S. policy in Nicaragua and South Africa.

Originally, 329 persons were arrested and charged with demonstrating without a permit. This is a misdemeanor offense for which police issue citations that are similar to traffic tickets. A person can pay a $50 fine or plead not guilty and ask for a trial. The maximum penalty after a conviction is six months in prison and a $500 fine,

Most of the demonstrators paid the $50 fine but in May and June, the 128 demonstrators who had asked for a trial on the original charges were also charged with blocking the entrances to the White House, a second misdemeanor offense.

Yesterday, the 38 defendants, who had decided not to pay the $50 fine appeared before Judge Robinson.

Their lawyer Daniel Ellenbogen argued that by adding the second charge the government was guilty of vindictive prosecution, a violation of due process rights guaranteed by the U.S. Constitution. He said prosecutors were in effect penalizing those who wanted to "make the government prove its case" at trial.

Assistant U.S. Attorney Robert E. McDaniel said filing the two charges was a legitimate exercise of prosecutorial discretion. He said it was part of a plea bargaining process that has been upheld by the U.S. Supreme Court.

In court yesterday McDaniel said that the government would drop the charge of blocking an entrance and wanted to go to trial only on the original charge of demonstrating without a permit.

But Robinson dismissed that charge too, declaring that by filing the second charge the government had improperly "upped the ante" for demonstrators.

"I was surprised he did it," said Sebastian Graber, another defense attorney. "Motions like this are filed all the time and the judges always throw them out. But it shows you that justice can be done.