John D. Backe seemed to be riding high at CBS Inc. -- until Thursday night.

The 47-year-old president had just put the television network back in the prime-time ratings lead, which ABC had wrested from CBS four years ago, and CBS Records was back on track after several shaky years.

Backe spent last Wednesday and Thursday in Los Angeles at a meeting of the network's several hundred affiliate stations, which were "ecstatically happy" with Backe because CBS had recaptured the prime-time lead.

With such successes, Backe began telling interviewers that he was firmly in command at CBS. He found out Thursday night he was not because William S. Paley, its founder, chairman and chief stockholder, is still around.

Only hours after Backe returned triumphantly to New York from the affiliates meeting, CBS announced that he had resigned as president, chief executive officer and director.

But everyone in the broadcast industry, at CBS and elsewhere, agrees that Backe had been fired. No explanation has been given.

"Clearly there is some dissatisfaction," said Ellen Berland Sachar, who analyzes the broadcasting industry for the brokerage firm of Goldman Sachs and Co. "It shows again who is in charge. It's Mr. Paley's candy store." a

Paley has been chairman of the board of CBS since 1927, and relinquished the title of chief executive officer to Backe under some pressure from the board in May 1977. With the added clout of being chief executive, Backe set out to restore CBS's eroded financial position and to explore the new technologies that are exploding in the electronic communications industry: home video discs, cable television and "Teletext," the transmission of written data through broadcasting.

Earlier this year, CBS announced tht it had signed a pact with RCA Corp. (which owns longtime rival NBC) to produce video discs for the home machines RCA is manufacturing and plans to introduce next year.

Industry experts say that the 78-year-old Paley is uncomfortable with the new areas his company is venturing into and that he has questioned sharply Backe's contention that CBS is an information and communications company, more than just a broadcaster.

They also note that Backe lately has been playing an increasingly visible role in the running of CBS. In a long interview with TV Digest recently Backe outlined his plans for the company, barely mentioning the chairman's role.

Not all observers think the Backe firing represents a personal pique on the part of Paley. The backbone of CBS is broadcasting, and Backe's desire to reduce the role of broadcasting might be seen as a questionable goal. They suggest that the board and Paley may have fired Backe because they think he is talking the company into unchanted fields.

Backe's predecessor, Taylor, managed a successful campaign to rid CBS of its losing operations. His ouster was a surprise too. But when CBS lost its 20-year hold on television supremacy, it became apparent that a large part of the reason was Taylor's inattention to broadcasting, sources said.

But neither Backe nor Paley nor any other CBS executive who knows the reason for Backe's ouster could be reached. All CBS will say is that Backe resigned his $732,000-a-year job.

'You're going to have to look hard to find a business reason that explains this," said one CBS insider.

What is known is that after Backe touched down in New York Thursday evening, he went to a meeting of the board of directors' executive committee, of which he is a member. CBS sources say Paley was not at the meeting.

A stormy argument broke out at the meeting, sources said, but it was not clear whether the argument led to Backe's dismissal or whether the disagreement was over a preordained decision on Backe's resignation.

In any event, said one analyst close to CBS, Backe was told during the session that Paley desired his resignation. At 9:30 p.m. Thursday, CBS issued an eight-line statement that Backe had resigned and that until a successor is named, the "chief executive function" will be carried by a four-man group -- Paley, Executive Vice President John R. Purcell, CBS broadcast President Gene F. Jankowski and CBS Records President Walter R. Yetnikoff -- in the chairman's office.

The stock market took the announcement surprisingly well. CBS shares closed at 43 1/2 on the New York Stock Exchange, down 75 cents from the Thursday price.

Although first quarter earnings at the broadcast-record-publishing giant had declined, the dip was anticipated. Profits for the full year were expected to rise, as they had every year since Backe took over after the 1976 firing of his predecessor, Arthur Taylor.

But analysts are concerned that there may be hidden problems at CBS. After Taylor was ousted in late 1976, Sachar said, it became apparent that the network had few new shows that it could plug into its programming schedule to replace ones that were not doing well. She has been assured by CBS executives that no such hidden problems exist today, she said.

Another Wall Street concern, said another analyst, is that the Backe ouster shows that the conglomerate is still being run by an aging, erratic executive who can get his way whenever he wants to.

Even though the board pressured Paley into giving up some of his powers to Backe in 1977, directors for the most part remain loyal to the chairman, and several are close social friends as well as longtime business associates.

"Nobody ever has a secure job at CBS" with Paley around, said David Goldsmith, an analyst with John Muir & Co.

The 78-year-old chairman, a pioneer of the broadcast industry, is reluctant to move into the new technologies that Backe embraced so whole-heartedly.

"Paley knows it had to be done, but he sees it as a necessary evil. Not a good in and of itself," said one industry observer. "But Backe should have just done it and been more quiet about it."