President Reagan yesterday promised King Juan Carlos of Spain that he will press for Spain's early entry into the NATO alliance, and the king in turn offered to use his close ties with moderate Arab leaders to promote peace in the Middle East.

Hailing the king as a "champion of democracy," Reagan said he and the Spanish monarch had discussed "the importance of forging even closer Western unity and cohesion in the face of a determined Soviet challenge."

Speaking to reporters after 1 1/2 hours of meetings at the White House with the king and assorted advisers, Reagan added:

"We spent considerable time comparing notes on the Middle East and the interest which our two countries share in promoting peace and stability in that troubled region so recently shaken by the tragic death of Egyptian President Sadat."

A senior U.S. official who sat in on the meetings said Juan Carlos told Reagan that Spain has "excellent relations" with moderate Arab leaders, particularly King Hussein of Jordan and the royal family in Saudi Arabia.

The king volunteered to use these ties to promote peace in the uncertain Mideast, according to this official, who spoke to reporters with the understanding that he would not be identified by name.

In their initial meeting in the Oval Office, according to this U.S. official, Juan Carlos asked Reagan for explanations of U.S. Mideast policy, including the U.S. stance on negotiations with the Palestine Liberation Organization and the future of the Camp David accords.

Reagan said that the United States seeks long-term peace and that sale of the Airborne Warning and Control System aircraft to Saudi Arabia will be important in stabilizing the region, the official said.

Secretary of State Alexander M. Haig Jr., who sat in on the sessions, elaborated, saying that the United States views the Camp David accords as a suitable process for achieving a lasting peace in the Mideast.

He reiterated the U.S. position that, before discussions can be held with the PLO, the organization must recognize Israel's right to exist and must endorse United Nations Security Council resolutions 242 and 338, which support the principle of all nations in the region being able to live within secure and recognized borders.

The king emphasized Spain's strong desire to join in the North Atlantic Treaty Organization military alliance and the European Economic Community. He asked Reagan's assistance in smoothing the way for Spain's acceptance by America's European allies, the U.S. official said, and Reagan gave assurances that he will do all he can in that regard.

Juan Carlos was to have been among the first state visitors of the Reagan presidency, but his trip here earlier this year was canceled due to events that led to the abortive right-wing coup in Spain.

Yesterday, after the two leaders stood at attention during a welcoming 21-gun salute and the two national anthems, the president lavishly praised the king's leadership in Spain after decades of rule by Generalissimo Francisco Franco.

"We applaud the sensible path toward political liberty that you've chosen and the skill, and if I may add, personal courage that you've demonstrated in reaching your goal," Reagan said.

He also praised Spain for "playing a leading role in the struggle to combat terrorism on the European continent. Such initiative is well appreciated here."