A federal judge here ruled yesterday that the government's chief personnel officer exceeded his authority when he unilaterally eliminated abortion coverage from all 1982 federal health care plans except for cases where a woman's life is endangered.

Judge Gerhard A. Gesell's decision directly affects only one of more than 100 health care plans available to federal workers, but his ruling could be used to support additional legal challenges to the government's effort to eliminate abortion coverage from its workers' insurance plans. The federal government paid $9 million last year to help finance 17,000 abortions through the insurance plans, including 3,400 in the Washington area.

Gesell's ruling came in a lawsuit brought by the American Federation of Government Employees, which has 44,000 government workers enrolled in its health benefits plan. The union contended that Donald J. Devine, the director of the Office of Personnel Management (OPM), acted illegally when he announced last month that he would disapprove any health plan that provided abortion coverage beyond life-saving measures.

Devine had said that his decision was based on overall budget considerations and followed the intent of both Congress and the Reagan administration to end federal payments for abortions. But Gesell said in a five-page opinion that Devine had no grounds to support his cost argument and has instead been "prompted primarily by ideological considerations . . . ."

Although the House has approved action to eliminate nonemergency abortion coverage from federal health benefit plans, there is no way to predict now how the full Congress will decide the issue, Gesell wrote.

"Mr. Devine's attempt to guess how Congress will act on this important issue now under intense consideration by that body represents usurpation of the democratic processes," Gesell said in his opinion.

Moreover, Gesell wrote, neither policy statements by the Reagan administration, nor previous action by Congress to cut off Medicaid-funded abortions, support Devine's claim that his actions were in line with the intent of the legislative or executive branches of government.

"In short, it is apparent from close scrutiny that the OPM decision was not based on relevant factors and that the director has abused his legal authority," Gesell wrote.

An OPM spokesman said Devine would have no comment on Gesell's ruling.

Government attorneys said that no decision has been made whether to appeal Gesell's decision to the U.S. Court of Appeals here. The OPM spokesman, Pat Korten, predicted that the court ruling could cause serious confusion in the government's efforts to complete negotiations on health plans for 1982.

Korten said that virtually all of the health plan carriers had agreed to eliminate all but emergency abortion coverage from their health plans in order to be allowed to go ahead with contracts with OPM. Many of those carriers had protested the government's insistence that the coverage be eliminated, but only AFGE went to court, Korten said.

AFGE staff counsel Kevin M. Grile said that Gesell's decision means at least that broader abortion coverage will be available to women enrolled in the AFGE plan.

OPM, within its Federal Employees Health Benefits Program, contracts for health insurance plans with two major carriers, Blue Cross and Aetna; with more than 80 health maintenance organizations and more than 40 unions, such as AFGE. Three of the those plans currently exclude abortions from coverage and another 28 only allow for them if the woman's life is in danger.

The government pays 60 percent of the premium cost on the plans and the employes the remainder. Each year there is a so-called "open season" during which government workers can switch coverage from one plan to another.

Gesell wrote that when Congress enacted the federal health benefits program, it intended to protect government workers against the high cost of medical care. It also wanted to put health benefits available to federal employes on a par with those available to the private work force, so that the government could compete for personnel, Gesell wrote.

There is nothing in the law, however, Gesell wrote, "which authorizes OPM unilaterally to exclude from a plan a type of benefit which is normally found in comprehensive health plans." Instead, Gesell said, the objective was that there be a process of negotiation in which both sides agreed on a plan at an overall price acceptable to OPM.

While OPM could exclude a benefit that was overly expensive in comparison to services received, it failed to justify its abortion coverage cutback on those grounds, Gesell said.