The government yesterday appealed a D.C. Superior Court judge's reduction of the lengthy prison sentence imposed on one of the Hanafi Muslims convicted three years ago in the violent takeover of the headquarters building of B'nai B'rith, a major Jewish service organization.

In papers filed with the D.C. Court of Appeals, U.S. Attorney Charles F. C. Ruff said the government was appealing D.C. Superior Court Judge Nicholas S. Nunzio's ruling last week vacating the 36-to-108-year sentence of Abdul Hamid and placing him on five years' probation.

It also was appealing Nunzio's order Thursday that further reduced Hamid's sentence effectively to time severed without probation.

Hamid was convicted in July 1977 of eight counts of armed kidnapping, conspiracy to commit kidnapping while learned and assault with a dangerous weapon.

Nunzio sentenced him to the lengthy term, which he was serving at a federal prison in Lompoc, Calif. Hamid had corresponded with the judge, cooperated fully with prison authorities, pursued educational and vocational training and apparently convinced Nunzio that he was rehabilitated.

The government's appeal of Hamid's release apparently was based on objections made by Assistant U.S. Attorney Paul L. Knight, who had argued in court that Nunzio lacked authority to vacate Hamid's sentence in its entirety.