The Environmental Protection Agency began a broad and unusual cleanup campaign yesterday against one of the nation's largest and most persistent polluters - the federal government.

In an announcement yesterday EPA warned 77 federal installations to stop polluting the nation's water ways. It told 72 federal facilities to halt violations of federal air pollution regulations. In a novel move, EPA threatened to take court action against federal agencies that do not mend their dirty ways.

Among the federal polluters were a dozen or more polluters in the District, Maryland and Virginia - including Maryland's Aberdeen Proving Grounds, the federal government central heating plant in Southwest Washington and Virginia's Fl. Belvoir Aberdeen Proving Grounds was cited as one of the nation's 13 worst federal offenders of antipollution laws.

In a series of letters yesterday to federal polluters. EPA Deputy Administrator Barbara Blum raised the prospect of court suits against the federal government itself by urging a "prompt resolution" of pollution violations in order to avoid judicial action.

An EPA spokesman said that the agency if necessary would file civil suits against federal installations that refused to stop polluting. Such a suit, the spokesman said, could lead to a court order in which a military base commander or the head of some other federal agency might be held personally responsible for pollution violations. An agency chief, the spokesman added, might face court - imposed penalties, including jail if he failed to comply with a court order.

In a similar action, EPA recently joined in a federal court suit against the quasigovernmental Tennessee Valley Authority and Kentucky and citizen's groups contend that TVA is dragging its feet in cleaning up its sulfur dioxide emissions into the air.

The federal government's effort to crack down on its own air and water pollution violations followed a move last June to curb water pollution caused by industrial plants and municipal government installtions. EPA announced plans to bring suits against more than 100 cities and 300 major industrial plants that, it said, failed to meet the nation's July 1 water cleanup deadline.

The threat by EPA sparked protests from business groups. They asserted that the government was blaming imdustry for poluution malpractices while ignoring its own widespread violations of the same cleanup deadline and laws.

During the Nixon and Ford administration, the federal government sought several times to persuade federal agencies to comply voluntarily with antipollution laws but, according to federal officials, these attempts were at best only partly successful.

Two recent developments, an EPA spokesman said yesterday, gave EPA the authority to begin yesterday's tougher crackdown. One was a recent change in federal antipollution laws designed to let EPA sue federal agencies for pollution violations. The other, the spokesman said, was a new willingness by the Office of Management and Budget to support federal agencies requests for money to install antipollution equipment.

Aberdeen Proving Grounds, in Harford County, was the only federal installtion in Maryland. Virginia or D.C. to be included among EPA's list of "major" violator - those expected to be the first targets of the EPA crackdown. Eight other water polluters and 12 air polluters were named in Washington and its two neighboring states.

Aberdeen was accused of failing to give adequate sewage treatment to wastewater that it dumps into several small rivers and creeks. EPA said that, according to its current schedule, Aberdeen does not expect to comply with federal water pollution regulations until December, 1980 - almost 3 1/2 years after the government's water cleanup deadline.

Among the federal installations in Washington cited for air pollution violations was General Services Administration's central heating plant at 13th and C Streets SW, which has long been a target of cleanup attacks.

An EPA spokesman said that the plant continues to violate an earlier agreement to stop polluting the city's air. The plant has also been the focus of a suit by the the District government.