President Reagan and Morocco's King Hassan II conferred in the Oval Office, at the luncheon table and on horseback yesterday as the two countries approached a final agreement on U.S. military use of a Moroccan air base.

The "working visit" by Hassan, which began with the series of meetings with Reagan at the White House and on the bridle paths, is expected to resolve all, or nearly all, the remaining obstacles to a written military facilities agreement by the time Hassan leaves here Friday, reporters were told in a White House briefing.

A senior administration official said Hassan previously had agreed in principle to U.S. use of one Moroccan air base by the Rapid Deployment Force in case of emergency, and that the details may be ironed out during this visit.

Discussions on the issue were begun by Secretary of State Alexander M. Haig Jr. on a trip to Marrakech in February. At that time, U.S. use of two Moroccan military facilities was under discussion.

Reagan, in yesterday's Oval Office and luncheon talks, expressed appreciation to the king for arranging use of the facilities, and his hope that the discussions on this issue will move forward, according to the U.S. briefing.

There was no official briefing on what the two said while riding for 75 minutes at Fairfield Farms near Hume, Va. As they prepared to leave the White House by helicopter in their riding garb, Reagan and Hassan exchanged expressions of friendship before cameras and reporters.

Reagan has asked Congress for $100 million in military sales credits for Morocco, a sharp increase over the loan funds provided in the current year. Congress originally provided $30 million, and has not acted on a supplemental request for an additional $20 million.

The House Foreign Affairs Committee voted last week to limit credits in the new budget year to $50 million. The lawmakers also recommended that U.S. military advisers or other personnel not be permitted to go into the contested area of the Spanish Sahara, where Morocco is waging a desert war against indigenous guerrillas fighting as an Algeria-based "Polisario Front."

The Carter administration approved sales of sophisticated military equipment for Morocco only after a lengthy internal debate about the advisability of becoming involved in the Saharan war and after linking the sales to a negotiated settlement of the war.

The Reagan administration, taking a different attitude, has removed all restrictions on the use of the U.S. military gear in the Sahara, according to the White House briefing yesterday.

Last June, Hassan proposed a referendum in the disputed area as a step toward settlement of the conflict, but this plan has bogged down in intense political maneuverings within the Organization of African Unity, which was to have a role in organizing the vote.

Hassan, who has been helpful in the past in arranging negotiations between Israel and Arab states, is president of the Islamic nations' committee for the "liberation" of Jerusalem.

He discussed Middle Eastern affairs in his talks with Reagan and said, perhaps in reference to this area, that the United States and Morocco do not share the same analysis or the same position on all situations, though they have much in common.

In the private talks, the White House briefer said, Hassan "expressed himself on Middle East issues along the lines you would expect."

The king is scheduled to meet Haig, Secretary of Defense Caspar W. Weinberger and members of Congress today, and to be guest of honor at a dinner given by Vice President Bush tonight.