CHICAGO (AP) _ A federal judge has rejected a claim by Sears, Roebuck & Co. that it should recover millions of dollars in legal fees it paid defending a sex discrimination lawsuit brought by the Equal Employment Opportunity Commission.

U.S. District Judge John A. Nordberg rejected all but a small portion of the arguments made by attorneys for Sears tha the EEOC pay its legal fees - previously estimated to be more than $20 million - for a 12-year fight over Sears' hiring, pay and promotion policies for women.

Tuesday's ruling came almost a year after a decision by Nordberg that Sears did not discriminate against women. Nordberg criticized the EEOC for relying on highly technical statistical analyses that he said were extremely flawed.

Less than two weeks after the EEOC lost the case, Charles Morgan Jr., a Sears lawyer, filed a petition asking for the EEOC to pay the company's costs and legal fees because the government agency's case had been ''exposed as frivolous, unreasonable or without foundation.''

Nordberg acknowledged in his most recent decision that the EEOC's case, ''when placed on the spectrum between watertight cases on one end, and frivolous cases on the other, is much closer to the latter than the former.''

However, the judge added, when compared with other cases found to be frivolous, the EEOC case was a ''reasoned investigation and lawsuit.''

The judge did rule that Sears was entitled to its fees expended when the EEOC turned over faulty evidence and data before the trial, which began in September 1984.