President Carter said yesterday that successful achievement of an Egyptian-Israeli peace agreement could cause the two countries to evolve into major forces for security and stability in the turmoil-torn Middle East.

Speaking to a gathering of editors and broadcasters at the State Department, the president in particular cited Egypt as a nation whose sizable armed forces and influence in the Arab world could lead it to the role of protecting smaller Arab countries against aggression.

Carter's comments came after Egyptian President Anwar Sadat told Defense Secretary Harold Brown last Saturday that Egypt is willing to assume a major stabilizing military role in the Middle East if the United States helps in reequipping the Egyptian armed forces. U.S. sources have said that Egypt wants billions of dollars in modern American weapons and equipment.

Asked about Egypt taking such a role in the wake of the turmoil that has displaced Iran as the Middle East's principal pro-western military power, the president replied that he didn't want to comment on "Egypt as a policeman" for the region. He also stressed that military aid of the magnitude being sought by Sadat "might well be beyond our means."

But Carter obviously had in mind the conversations with Sadat and other Middle Eastern leaders reported to him by Brown, who recently completed a 10-day tour of the region. He also seemed to be looking beyond the Egyptian-Israeli peace talks in progress at Camp David, Md., and speculating out loud about the possible contributions the two countries could make to regional security if their negotiations are successful.

Carter noted that Egypt has "five divisions or more" facing Israeli troops in the Sinai peninsula. If a peace agreement were to free these forces from defense of the Sinai, he said, "they might well be used to preserve the peace" elsewhere in the Middle East and make Egypt into "a genuinely legitimate stabilizing force."

He added that the administration is beginning consultations with Congress, based on the reports brought back by Brown, to see what might be done about increasing U.S. military assistance to friendly countries in the Middle East.

Administration sources said later that, while the president intends to give serious attention to Sadat's offer of an increased military role, no commitments have been made by the United States and it is unlikely that any will be until the pattern of events in the Middle East becomes much clearer.

The Defense Department announced yesterday that it will send a team of arms experts to Egypt within six to eight weeks to study that country's defense needs in the wake of Brown's visit. However, administration sources stressed that Brown has made clear to Sadat that there is little chance of Egypt receiving any big infusions of U.S. arms without a treaty settling Egypt's conflict with Israel.

Carter also underscored that qualification when, after talking about Egypt's potential stabilizing role, he added: "I'm not predicting this would happen."

In response to questions about why Washington doesn't use more pressure to help the Middle East peace talk along, Carter said there were instances where the United States was unable to order events as it would like.

"In complete candor, we have approached our limits on legitimate influence and perhaps even pressure on all the countries in that entire region to endorse and participate in the Camp David accords," he said. But, he added, other key Arab states such as Saudi Arabia, Jordan and Syria so far have refused to follow Egypt's lead in pursuing peace negotiations with Israel.

This theme, which he first sounded in a speech at Georgia Tech in Atlanta on Tuesday, dominated the statement with which he opened the meeting with the editors and broadcasters.

Because of the upheavals and violence gripping Iran and Southeast Asia, Carter said, "a national debate" has broken out about the role of the United States in the world, even in events that are "not of our making."

The president appealed to his media audience, and through it to the American public, to resist the temptation to see global changes in simplest terms of gains or losses for the United States or the Soviet Union. Many situations, including the turmoil in Iran and the conflicts involving China and Vietnam, were products of complex historical circumstances, he said.

If it becomes necessary to protect vital U.S. interests or honor commitments to allies, Carter warned, he would not hesitate to use military force abroad. But he also noted with pride that he had not been forced to do so during the first two years of his presidency and added: I hope we are able to keep this precious peace."

When an editor cited public feeling that the administration's foreign policy is irresolute, Carter responded that it is easier to rally patriotic support in times when forceful action is required. It is much harder for a president able to maintain peace to obtain such widespread backing, he asserted.

Competition and tension with rival superpowers like the Soviet Union are "inevitable," he said. But he then cited a number of countries -- among them China, Egypt and India -- that recently have moved toward closer ties with the West and said: "On balance, the trends have not been adverse to our country."