President Reagan's most cherished programs and his decision about whether to seek a second term could ride on the outcome of the Nov. 2 congressional midterm elections.

Intimates and aides of the president agree that the administration will face new challenges in its effort to maintain a working coalition of Republicans and conservative Democrats if GOP losses in the House run much higher than 15 seats. But they are in broad disagreement as to whether heavy GOP losses would make Reagan more or less likely to run in 1984. Immediately at stake for the president is continuation of what some have called "the Reagan revolution."

As increasingly pessimistic election reports filter into the White House, presidential strategists have begun to recognize that Reagan may be faced with a choice of scaling back his ambitious agenda or sliding into a stalemate with Congress reminiscent of the Ford and Carter years.

How Reagan reacts to the challenge of a Congress in which he cannot easily work his will seems certain to influence whether he seeks a second term. The official White House line has been to declare, whenever the question is posed, that Reagan has made no decision but is not likely to walk away from an unfinished job. This is supposed to be interpreted as an unmistakable hint that Reagan will seek a second term.

The bland, strategic answer conceals some sharply differing internal assessments. These range from flat assertions that Reagan will run to predictions that he will voluntarily retire if his administration becomes locked in a stalemate with Congress.

One of those skeptical about a second term said recently that a stalemate could "take the fun out of the presidency" for Reagan, who has maintained his health and clearly enjoys his job. Another person close to Reagan believes that congressional setbacks would "get the president's Irish up" and make him more determined than ever to seek another term.

"He's better when the odds are against him," this intimate said. "And if he loses big, he will have a big target if the Congress frustrates him."

Reagan is not frustrated by the presidency, those who know him agree. But he confessed recently in an interview with U.S. News & World Report that "all the homework" required of a president becomes "tedious." He also has confided to old friends that he misses California.

What must be measured against this complaint is Reagan's old-fashioned, almost fatalistic sense of duty and a competitiveness that he has displayed since he was an underweight lineman on the Dixon, Ill., high school football team.

"He loves to win," one senior administration official said.

Whatever Reagan decides is likely to be influenced by the opinion of Nancy Reagan, who reportedly prefers that he quit after one term. Though the president is always respectful of his wife's opinions, he sometimes reaches conclusions, such as his decision to debate President Carter in the 1980 campaign, that run counter to hers.

Recalling this, one White House aide commented: "I think that she won't want him to run, and I think he'll run anyway."

Next week's elections are likely to influence the timing of Reagan's decision.

"If we take a bath, it will increase pressure for an early decision," one senior administration official said last week.

The official noted that considerable pressure will come from within the White House and from Republican officeholders for an early declaration by Reagan to preserve the power of the presidency in dealing with Congress.

Potential Republican presidential candidates in 1984, among them Vice President Bush, Sen. Robert J. Dole (Kan.) and Rep. Jack Kemp (N.Y.), also would be likely to press for an early declaration.

On the other hand, if Republicans do relatively well in the elections, the focus is likely to be on prospects for Reagan's programs in 1983 rather than on whether he will seek reelection. In a speech last week, White House communications director David R. Gergen predicted that some of the battles over these programs would be "acrimonious" and "brutal."

On the CBS program "Face The Nation" a week ago Sunday, White House counselor Edwin Meese III passed up a chance to say flatly that Reagan would run again.

"My personal belief is that he probably will," Meese responded. "He hasn't made up his own mind yet . . . . But that doesn't mean that he's going to leave a lot of things undone to a second term . . . ."

Bracing for what seems certain to be at least moderate losses, White House officials contend that the administration can preserve its working coalition with a loss of 15 to 20 House seats, depending on which seats are lost. Some of those making this argument were saying only a few months ago that any GOP loss threatened preservation of the coalition.

The revised statistical evaluation is based largely on an analysis of the shift of congressional seats from the "Frost Belt" of the Northeast and Midwest to the "Sun Belt" of the South and West. Of these 17 seats, 12 are likely to be occupied by more conservative occupants, no matter which party wins.

Furthermore, 56 of the 63 Democrats who have supported Reagan on one or more key economic bills seem certain to be returning, and at least four of the seven other seats are likely to be held by congressmen who are potential administration votes on economic issues.

Curiously, the administration most fears loss of Republican "Gypsy Moth" seats in the Northeast held by congressmen who have been relatively independent of the administration. A seat lost in these districts is apt to be occupied by a liberal Democrat, while a seat lost by a conservative Sun Belt Republican is more likely to go to a moderate Democrat.

A House Democratic leadership source agrees that Reagan should be able to keep his coalition on most issues if the Republican loss is held to 15 to 18 seats. Returning Democrats will then hedge their bets for Reagan, he said, thinking that "he isn't as unpopular as we thought."

"If we win 15 seats, we still control a big majority of the House but not their hearts and minds," this Democrat said. "If Reagan can adjust to the fact that he is only going to get part of the pie, he will still pack a big wallop after the election. We still have to come to him."

One senior administration official who shares this view contends that even a large Democratic victory does not meant that Reagan's priorities will automatically be discarded. He said record deficits will still confront Congress, which will remain under even greater pressure than in 1981 to cut spending.

"I have a hard time believing the mandate is going to give," he said. "The pressures to get the deficit down are going to be there again."

But this official acknowledged that the president will face congressional efforts to force him to compromise on continued insistence on ever-increasing military spending.

The White House sees this pressure as bipartisan, and some aides even hope that the Republican-controlled Senate will take the lead in tempering the military buildup.

Some of these administration officials, while observing that the president is publicly intractable on cutting defense spending or raising taxes, point to Reagan's second-term record as California governor when he made several concessions on welfare and education issues to obtain legislation he wanted.

For all of the administration's "stay the course" rhetoric, these officials recognize that the president also moderately altered his course this year when he agreed to the $98.3 billion tax-increase bill passed with the cooperation of the Democratic leadership.

These officials are hoping that the pragmatic Reagan who wants to win will prevail over the ideological Reagan who talks about "staying the course" on the campaign stump.

"He knows how to negotiate," one official said. "He knows how to develop a strategy to bring his opposition in."