When law firms team up on the winning side of the same case, they sometimes find themselves at odds over who gets what share of the legal fees. Usually they settle their differences behind closed doors.

On rare occasions, however, the disputes are so strong and the stakes so high that the delicate issue of fee-splitting goes public.

One such occasion is the tangled case of a California lawyer and a prominent Washington law firm, whose long-standing dispute is now in the U.S. District Court here. At issue is $1 million in legal fees awarded to the lawyers for their work on a massive class-action lawsuit.

On one side is Earl C. Berger, a California-based lawyer in his mid-70s, a one-man law practice who has worked out of office in the United States and Europe. On the other are Alan Y. Cole and Isaac N. Groner of Cole and Groner. Both are Yale Law School graduates, both are former clerks to the U.S. Supreme Court, both have been in private practice since 1953 and both are well established in Washington.

Court records indicate that relations between the firm and Berger were amicable enough when the case began in 1970. Berger, who was then living in France, wrote Cole and Grover and asked if the firm would file a class-action lawsuit in Washington against the federal government on behalf of more than 19,000 current and former teachers in the Overseas Dependent School system. The teachers contended they were owed back pay, court records said. $&(WORD ILLEGIBLE

According to the records, Berger had represented the overseas teachers for more than 10 years. Cole andGroner had helped him in the late 1960s in several unsuccessful attempts in court to get the teachers the back pay they said they were due.

The lawyers drew up a contract, and Cole and Groner agreed to bring the case. If the court awarded any legal fees, they agreed, Cole and Groner would split them 50-50 with Berger. Cole wrote to Berger that he hoped "our efforst will be successful."

Indeed they were. In November 1974, a unanimous U.S. Court of Appeals ordered the Defense Department to pay the teachers millions of dollars in back pay. Eventually the teachers would collect more than $55 million.

Once the case was won, U.S. District Court Judge June L. Green, who heard the case at the trial level, had to decide how much of the winnings the lawyers would get for their work on the case. According to court records, that's when the relationship between the Washington law firm and the California lawyer went sour.

The trouble started, the records show, when Green approved a final judgment in the case, giving the lawyers 2 percent of the total money awarded in legal fees - an estimated $1 million. Court records said the money would be paid to Cole and groner and that Berger would receive "a heretofore agreed upon share of the counsel fees..."

Berger contends that Cole and Groner settled the case for the 2 percent figure without his approval and thus violated the 1970 contract agreement, according to court records.

He argues, the records say, that the court should have awarded him 25 percent in fees, based on retainer agreements he had reached with 2,900 of the teachers in 1965.

Cole and Groner, however, argue in court papers that the 2 percent figure was reached during long negotiations with the government's lawyers and that Berger approved the agreement. Berger, who could not be reached for comment, has denied he approved the agreement, according to court records.

The records say that Cole and Groner told Berger that his repeated attempts to challenge Green's judgment in the case violated the 1970 contract, which, the firm says, gave them the last word on decisions about the case.

Since Berger breached the contract, Cole and Grover content, they aren't obliged to pay him a nickel of the $1 million fee.

In February 197, Berger filed a lawsuit contending that it was Cole and Groner who breached the 1970 contract, because they refused to pay him his half of the fees awarded in the teachers case.

Berger, now represented by former Watergate prosecutor Richard Ben-Veniste of Melrod, Redman and Gartlan in Washington, contends that the court was bound to the 25 percent figure set out in the 1965 retainer agreements with the teachers and that Cole and Groner should have negotiated for that figure.

Therefore, Berger argues in court records, by the terms of the 1970 contract with Cole and Groner, he is owed half of 25 percent of the total amount recovered - about $6 million. Berger has also asked for $1 million in damages, according to the records.

The case of Berger vs. Cole has escalated into large-scale legal warfare. In a lengthy filing in the federal court last week, Cole and Groner contend that neither the government nor the court would have agreed to an award as high as 25 percent for legal fees.

The firm also contends that, as the law stands now, attorneys' fees in class-action lawsuits are up to the discretion of the court, which can disregard retainer agreements.

Cole and Groner, represented by Franklin M. Schultz of Purcell and Nelson in Washington, said in court papers that they had to spend money to set up an office and process back pay claims from teachers all over the the world. According to those court records, they also had to pay legal fees to defend themselves against Berger's challenges to Green's judgment. Therefore, the firm said, they are owed $175,000 in expenses and they ask for another $525,000 in damages against Berger.

U.S. District Court Judge Thomas A. Flannery has scheduled a hearing on the dispute for August 24. Meanwhile, the case continues to breed complications.

For example, Cole and Groner's legal malpractice insurere has asked the court here to decide whether Berger's allegations are covered by the insurance policy issued to Cole and Groner.

And, another California lawyer has contended in court papers that a client of his is owed whatever money Berger is awarded as a result of the teachers case because of a judgment against Berger in a separate California case. Berger has appealed that judgment.