Mobil Corp. Chairman Rawleigh Warner Jr. said today his company agreed to a $30 million settlement of a claim that it had violated the Carter administration's price standard because a court victory by Mobil might have killed the entire voluntary anti-inflation program.

The Council on Wage and Price Stability charged that Mobil exceeded its allowable revenues under the price standard by $45 million in the third quarter of last year, and President Carter publicly castigated Mobil for that violation on several occasions.

"We were prepared on the final analysis to take the issue to court," Warner said at a press conference following the company's annual meeting here. Mobil decided not to file a suit because "we might have been responsible for bringing the whole Council on Wage and Price Stability down."

"It was in the interest of Mobil shareholders and the country to settle," Warner said.

The administration agreed last month to consider Mobil back in compliance with the price standards after the company said it would reduce the revenues it could otherwise receive under the standard by $30 million between now and the end of September. As part of the settlement, the White House agreed to say -- and did -- that the dispute stemmed from an honest difference of opinion between Mobil and COWPS.

In another matter, Warner and Mobil President William P. Tavoulareas warned that relations between the United States and Saudi Arabia could be severely damaged if the Public Broadcasting Service shows a film, "Death of a Princess," scheduled to be aired next Monday. The film depicts the execution of a member of the Saudi royal family after an adultrous affair.

"We hope that irreparable damage won't be done to relations between Saudi Arabia and the United States," Tavoulareas declared. After the film was shown in Great Britain, the British government officially expressed its regret to the Saudis, who nevertheless cancelled a number of contracts with British companies, he said.

Saudi Arabia produces 9.5 million barrels of oil daily, most of which goes to Mobil and other U.S. oil companies. Privately some industry officials are concerned the Saudis might cut oil production if the film is shown.

In comments to the annual meeting, Tavoulareas defended Mobil's high profits -- more than $2 billion in 1979 -- against what he called "unfair attacks by some politicians, special interest groups and some segments of the press. . . ."

With an obvious reference to the proposed federal loan guarantees for the ailing Chrysler Corp., he added, "It seems ironic that when companies are not operating at a profit they should receive so much attention and aid, while companies that do show a profit are treated with hostility."

"The sober truth is that we aren't generating enough cash to make all the investments we will need to make the next decade."

Warner also told the stockholders that Mobil's Montgomery Ward subsidiary, which lost $46 million in the first quarter of this year, is "going to have a difficult two or three years." The company is "one of the most highly leveraged of the major retailers" -- that is, it operates using large amounts of borrowed money -- and suffers from "excruciatingly high interest rates," he said.

In addition, Montgomery Ward, which has many stores in the Detroit area, has been hard hit by the recession in the automobile industry which now is spreading through the country. Beyond that, Warner said, it also is making new investments in stores it recently purchased from a bankrupt retailing chain that are not yet reopened.

"It's not pleasant for Montgomery Ward," Warner said, "but not dire for them."

Warner also said the Securities and Exchange Commission still was investigating whether Mobil or Tavoulareas had violated SEC rules or regulations in dealings between them and Tavoulareas' son, Peter, head of Atlas Maritime Co., a London-based ship chartering and operating company.

Allegations were made last year that Mobil's president has engaged in nepotism, helping set up his son in business, in effect, while using certain Mobil resources to do so. Tavoulareas and the company repeatedly have denied any wrongdoing.

"The allegations printed in the newspaper were, in most instances, false and misleading," Warner told the meeting after a stockholder demanded Tavoulareas resign. The Washington Post was among the newspapers carrying such stories last year.

Warner said that William Jackson, an attorney specializing in SEC matters hired by Mobil to represent it on the case, recently had assured the board of directors that, in his opinion, no violations of rules or regulations had occured.

Other stockholders criticized Mobil vice president and director of public affairs Herbert Schmertz for working late last year on Sen. Edward M. Kennedy's campaign for the Democratic presidential nomination while the Massachusetts senator was so hostile to oil companies.

The company should not have allowed Schmertz to work for Kennedy, one stockholder said, arguing that Mobil employes "should not join the enemy camp."

Warner said Schmertz had taken vacation time to work for Kennedy and that the company has a policy of long standing of encouraging employes to take time off to work in campaigns. "When we have a rule like that, it has to apply fairly to everyone," Warner said.

Stockholder resolutions seeking to limit Mobil's business activity in South Africa, sponsored by several church and university groups, were defeated. So was another resolution directing the company to continue to investigate whether Mobil's South African subsidiary supplied oil to Rhodesia during the years the United States embargoed trade with that nation.

"I will promise you we will go to Zimbabwe at that time" and examine the records of the Rhodesian company if it is returned to Mobil's control, Warner said. "We will take our cue from the government," which is now controlled by a black majority. "If they want this opened up, we will do it," he said.