In a case bitterly fought by the nation's major telephone compandies, the Fourth U.S. Circuit Court of Appeals has ruled that customers cannot be required to buy some of their telephone equipment from local telephone companies.

The 2-to-1 ruling by the appeals court was a major victory for the Federal Communications Commission, which last March announced a program designed to give telephone customers "freedom of choice" over where they purchase their telephones.

FCC officials said yesterday the court's ruling, unless appealed to the Supreme Court, could bring "more envenience and cheaper" telephone service to many Americans.

A spokesman for the American Telephone and Telegraph Co. in Washington, while not ruling out the possibility of an appeal, promised that the giant utility "will not roll over and play dead" if the court ruling is final. "We'll go out and open just as many telephone stores as anyone else," said jim Mundis, AT&T's news service director.

Under the FCC plan, approved by the appeals court, the nation's telephone companies essentially will lose control over the equipment installed in many homes and businesses. The FCC had ruled a year ago that the telephone companies can no longer require customers to purchase their equipment from them, or even require the customers to use company-approved "connecting devices" for equipment that the customers picked.

The commission held that the devices were unnecessary and the prices charged for them were so high that customers were being discouraged from buying equipment on their own.

Some state regulatory agencies and the nation's large telephone compnaies challenged the FCC action, saying that states - not the FCC - should regulate installations. They also charged that the order would cut into the profits of local telephone companies and force revisions of their rate structures.

Stanford Weinstein, an FCC lawyer, said yesterday that the court ruling will force many state regulatory agencies "to grapple for the first time" with the problem of establishing rates for telephone customers who supply all of their own equipment and use none of the equipment currently provided by local telephone companies.

Although Weinstein and other FCC officials saw the action as bringing lower cost telephone service to many, AT&T officials offered a different view. "We are concerned that the connection of customer - provided telephone equipment under the FCC proggram will have an adverse effect on the average telephone customer's service," said Thomas S. Nurnberger, an AT&T executive vice president.

The 50-page telephone equipment decision, released by the appeals court in Richmond, was the second setback AT&T received this week from the courts. Earlier a U.S. appeals court in New York refused to block an FCC order directing AT:T to lift restrictions it has imposed on customers who purchase private long-distance communications lines from AT&T.

If yesterday's Richmond dicision is upheld, it is almost certain to spur sales of telephone equipment produced by a wide variety of both American and foreign communications companies, FCC officials said. Since a 1969 FCC decision that initially opened the way for customers to buy their own equipment rather than having to lease it from a phone compnay, the telephone communication industry has grown greatly, according to FCC officials.

In the majority opinoion, Justices Richard T. Rives and Elbert P. Tuttle, rejected arguments by the North Carolina Utilities Commission that it has the power to regulate telephone installations and equipment. Such a ruling would lead to confusion and "conflicting state regulations," they said.

Justice H. Emory Widener Jr. dissented sharply from the court's ruling, saying that the FCC "made no findings of how, why, or if, competition" from makers of telephone equipment will, in fact, benefit the public. "The FCC has made a decision that will amost immediately affect the rates of practically every telephone remotest reasoned idea of how the total cost for telephone service will be affected," he said. "I think this conduct quite irresponsible, not to mention arbitary, capricious, an abuse of discretion, and not in accordance with law."