A federal judge has ruled that the Carter administration improperly restricted additional unemployment compensation to the long-term unemployed.

The administration had hoped to save more than $1 billion through the fall of 1981 by redefining last January the method for calculating when states are eligible to provide 13 weeks of additional unemployment insurance beyond the regular 26-week benefit period. The reduction in benefits would have affected about 1.2 million persons.

Judge Louis F. Oberdorfer ruled, however, that the Labor Department's new eligibility definition conflicted with the way Congress has interpreted the law that made the benefits available 10 years ago. Moreover, Oberdorfer said, the Secretary of Labor had issued regulations implementing the law that coincided with the way Congress had defined it.

Oberdorfer, in an opinion released late Thursday, said any changes in the definition would have to be made by Congress and not by the Secretary of Labor.

Oberdorfer acted in a case brought by the AFL-CIO and the United Auto Workers union. A spokesman for the Labor Department said yesterday; the agency is considering asking the U.S. Court of Appeals to review Oberdorfer's decision.

The money for the 13 weeks in extra benefits is available from federal accounts through the Federal-State Extended Unemployment Compensation Act passed by Congress in 1970.

The money automatically becomes available to the states when the number of persons receiving unemployment insurance within that state exceeds certain levels set out in the law.

Last January, as the Carter administration was wrestling with its budget for fiscal 1981, the Secretary of Labor issued rules to tighten up the way those levels were calculated, the effect of which was to cut down on the number of states receiving the money to pay out the 13 weeks in extra benefits.

In a joint statement, AFL-CIO President Lane Kirkland and UAW President Douglas Fraser said the "regulations were an attempt to reach an artificial budget figure and would have made non-persons out of the long-term unemployed."