The federal government said yesterday it will appeal a court ruling last month that directed the Reagan administration to release $180 million in revenue-sharing funds sequestered under the Gramm-Rudman-Hollings deficit reduction law.

The Justice Department filed a one-page notice saying it wants the U.S. Circuit Court of Appeals here to overturn the July 28 ruling by U.S. District Court Judge Joyce Hens Green. She declared that the $180 million was illegally transferred from the revenue-sharing trust fund to the general treasury last year.

The judge said the purpose of sequestering the money was to reduce the size of the 1986 deficit, not the deficit of succeeding years. Paying the 1986 grants in fiscal year 1987 is not inconsistent with the Gramm-Rudman-Hollings law, she said.

Under the revenue-sharing law, Congress provides annual grants of no less than $200 to local city and county governments. Green, in finding that Treasury Secretary James A. Baker III must turn the funds over to the local jurisdictions, said, "It is evident that defendant has improperly refused to disburse the sequestered funds and cannot justify his actions."

The Justice Department is representing Baker in the lawsuit filed by the National Association of Counties, National League of Cities, U.S. Conference of Mayors and 10 cities and counties.

Harvey Ruvin, president of the National Association of Counties, said, "We are outraged by the government's decision to appeal."