The president has the authority to enter into an agreement restricting the sale of Japanese automobiles here without violating antitrust laws, the Justice Department said Monday.

President Carter said on several occasions in November and December that he belived he might have no such authority and that he would not exercise it anyway.

But a letter -- not a formal legal opinion -- issued by the Justice Department also raised the question that, if an agreement to restrict imports were reached, the foreign auto manufacturers agreeing to curtail sales might be liable under U.S. antitrust laws.

Ford Motor Co., the United Auto Workers union and several congressmen and senators had unsuccessfully attempted to persuade Carter to negotiate with the Japanese to restrict sales of their vehicles here. Ford and the UAW contended that the sales were the major contributor to unemployment and financial problems in the U.S. auto industry.

Carter, who campaigned through the Midwest pledging help to the beleagured auto industry, later maintained that he had no clear authority under antitrust laws to enter into an agreement with the Japanese to restrain sales here of their automobiles and light trucks. The fear is that the president could be accused of working with private manufacturers or conspiring to restrain trade.

When Carter then said he would leave the decision to negotiate for import relief to President-elect Ronald Reagan, Ford and the UAW then attempted to have legislation passed in Congress that specifically would give Carter the authority he said he lacked to curb auto imports in general and those from Japan in particular. But in the waning days of the last session of Congress, these efforts failed.

Sen. Carl Levin (D-Mich.), who had requested an opinion from the Justice Department, said it was "pretty strong advice" that cleared up ambiguity about the president's authority among government lawyers and advisers. Levin said in the next Congress he will continue to push for legislation insuring the president's authority to negotiate such an auto import restraint agreement as "a safety valve."

Levin also said he is sending a copy of the Justice Department's letter to Reagan.

However, Reagan is "not committed to negotiating quotas or tariffs," said a member of the president-elect's economic policy coordinating group dealing with trade matters. But he added he didn't know if Reagan had ruled out such negotiations: "He has a clear awareness of the importance of the problem. It's one of those things you look at when the time comes."

In a letter responding to Levin's query, Associate Attorney General John Shenefield said the "president possesses such inherent constitutional authority" to enter into negotiations with a foreign government seeking import restraints and that neither the president nor his negotiators would violate antitrust laws if the agreement asked foreign governments to seek restraint from its national firms.

But Shenefield also said that the hadn't addressed "the potential antitrust exposure under current United States law for other involved parties, such as the foreign manufacturers." Levin said the possibility of antitrust violations by foreign manufacturers "is not our problem. That's their problem if there is any, and I don't think there is."

Shenefield also said in the letter that if the president and his negotiators were sued under antitrust laws, they probably would prevail ultimately. But in a ruling on a summary judgment, "there is a significant possibility that an artfully drafted complaint could withstand a motion to dismiss prior to at least some limited discovery."

Shenefield said yesterday in a telephone interview that the letter has no legal significance in any procedure but may be "persuasive in an argument."