The government wound up a 3 1/2-year legal battle yesterday by dropping all charges against Revolutionary Communist Party Chairman Bob Avakian, who was indicted with 16 others after a violent demonstration in 1979 against Chinese Vice Premier Deng Xiaoping near the White House.

Under a plea agreement accepted by D.C. Superior Court Judge Fred B. Ugast, the government agreed to drop assault and rioting charges against Avakian in exchange for each of 10 remaining defendants pleading guilty to one charge of assault and one charge of rioting.

Avakian is living in Paris and did not appear in court yesterday.

Charges against six others had been dismissed at various points during a long legal contest that at one point reached all the way to the Supreme Court. The fight spawned now-familiar painted signs of "Free Bob Avakian" along highways and buildings not only in this area but around the country, although Avakian actually was in jail for only two days after his arrest.

None of the defendants, including a nurse from Chicago, an unemployed railroad worker from Cleveland and a former editor of the Stanford Daily student newspaper, will serve time in prison. Ugast sentenced all of them to serve terms ranging from eight months to two years on probation, ordering some to pay fines of up to $500 and to perform up to 300 hours of community service.

"In light of the 3 1/2 years" that the case has dragged on, Ugast said, "all that took place that night should be put to rest."

Russell F. Canan, lead defense attorney for the group, called the government's plea bargain offer a "great victory." Canan said the prosecutors for years refused to allow the defendants, who were each charged with 25 felonies and faced maximum prison terms of 241 years, to plead to anything less than felony charges.

In the course of fighting the charges, the defendants subpoenaed what Canan said would be "damaging evidence" about wiretapping and harassment of Avakian and the Revolutionary Communist Party, a pro-Maoist group that opposes the present Chinese regime. Canan said he believes prosecutors accepted yesterday's plea bargain agreement to avoid having to turn over that evidence.

Assistant U.S. Attorney Timothy Reardon said in court that any allegation that the government was backing down because it was afraid to disclose wiretap information was "simply balderdash." Sources familiar with the investigation over the years said the case against Avakian, who has been out of the country since 1981 and has applied for political refugee status in France, was not strong.