New York environmentalists found an unexpected ally in January when they took the Federal Power Commission to the Supreme Court. The Justice Department representing seven other federal agencies, took their side.

That example was used in a presidential reorganization paper to illustrate the chaotic and uncoordinated state of the government's legal representation, where its almost 20,000 lawyers often take positions that hurt other agencies by running contrary to government-wide policy.

"That happens all the time; it's not unusual," said one high official of the Justice Department, which is fighting to keep its turf as the prime legal authority of the government against an assault by other agencies - especially independent regulatory bodies - who want to handle their legal matters.

The study on government lawyers, finished Friday and to be received today by cabinet members and heads of independent agencies, is part of President Carter's efforts to streamline the federal bureaucracy. The study was made available to The Washington Post.

It is the first look at the federal legal establishement since the 1955 Hoover Commission report on government organization.

Until now, no one knew how many lawyers were employed by the government. Today's study found there are 19,479 - with a little more than 10,000 working here and the rest scattered across the country.

That doesn't include lawyers who hold nonlegal government jobs, such as, for example, Secretary of State Cyrus R. Vance, a New York lawyer; Joseph A. Califano Jr., a Washington lawyer who is secretary of Health, Education and Welfare, or Simon Lazarus, who left the Washington firm of Arnold & porter to become associate director of President Carter's domestic policy staff.

One surprising point in the study is the small number of lawyers working for the Justice Department - 3,608, two-thirds of them spread through U.S. attorney's offices around the country.

The Pentagon, on the other hand, employs 5,247 attorneys, many attached to the judge advocate generals' offices of the military services. HEW employs 1,285 lawyers and 1,224 lawyers work for the Treasury Department.

Carter's study ordered in August, sent shock waves through the corps of federal attorneys, who feared it was an attempt to cut numbers. The president had suggested at his first cabinet meeting that the government consider reducting the number of lawyers in an attempt to cut unwieldy federal regulation.

One of the biggest problems found is the lack of coordination from one agency to another - "an individual agency may litigate a position that ultimately binds the entire government without even notifying other agencies that the issue is in court," the report said.

Thus, the government often finds itself in the uncomfortable position - as in the case before the Supreme Court - of arguing both sides of the issue. In that case, the FPC said government regulations ban it from paying the environmentalists' attorney fees and court costs in their successful battle to block construction of a power line. In fact, other government agenices do pay attorney fees for civic groups in similar cases.

"It's amazing how many cases come up with implications for other agencies," said a Justice Department attorney.

The biggest battle within the study task force - made up of lawyers from 15 government agencies - was not over the number of government lawyers but over who should have the prime responsibility for representing the government in court - the Justice Department or agency attorneys.

According to the report, agencies complain that Justice Department attorneys give short shrift to cases brought to them by regulatory agencies, such as the Food and Drug Administration or the Nuclear Regulatory Commission.

For example, twice as many lawyers in U.S. attorneys' offices were assigned last year to criminal cases than to civil matters, including the regulatory cases. They participated in five times as many criminal trials as civil. Moreover, in 60 percent of the 65,000 civil cases now in U.S. attorneys' offices, the government is the defendant.

"One result," the report concluded, "Is that civil enforcement proceedings (brought by regulatory agencies), in which the government is normally the plaintiff, sometimes are not filed or are substantially delayed to the detriment of the overall agency enforcement program."

Regulatory agencies argue they cannot do their jobs right if they can't take cases to court.

They also complain that Justice Department lawyers who represent them in court "are inexperienced, often in their first job out of law school and lack specialized knowledge of the area of the law" involved in the law-suit.

In contrast, the report continued, "agencies point out that their private bar adversaries are highly specialized in their knowledge of agency law."

On the other hand, the report said, while agency lawyers may know their specialties, they often lack the trial experience of attorneys for the Justice Department.

Moreover, some agency lawyers reportedly lack sufficient independence from the agency to render at all times objective and balanced legal advice," the report said.

While the report offered no solution, its draft - a final version will go tot he president by April 12 after cabinet officers and agency heads have a chance to comment - presented three major options: Keep things as they are, with Justice having prime responsibility of representing government but the 28 agencies who managed to carve out their own turf still having the right to go to court themselves.

Give all regulatory agencies the right to take cases to court with Justice representing the government in all other matters. This would require the Justice Department to delegate some authority to other government agencies.

Give Justice full authority to handle all government cases, but require it to allow agencies to handle purely routine case that just affect them. Under this option, Justice could take any case, but would become involved only when constitutional issues are raised or the issue cuts across agency lines.

This last option, the report noted, should reduce the number of government lawyers since most cases will not need two sets of government attorneys - one from Justice and one from the agency. But, the report said, it could also mean more suits being filed "thus creating further backlogs and delays in the federal courts."

The study found that agencies which do not take their cases to court have problems attracting top-flight young lawyers who are often lured by the possibility of gaining trial experience. The Securities and Exchange Commission and the National Labor Relations Board were cited as "agencies which are able to attract first-rate lawyers, in part because they control their own litigation."

Moreover, the study found that too many decisions have to be referred from attorneys in the field back to Washington creating added red tape and unneeded delays. It suggested a greater delegation of authority that would allow attorneys in the field to handle routine cases on their own.

Study director for the legal task force was Judith Areen while Christopher Davis was staff director. Comments on the report will be reviewed by F. T. Davis Jr., general counsel of the President's Reorganization Project.