President Reagan defended the record of his first two years in office yesterday as having set the United States on "the right course," and predicted that the third year will "see an American economy and an America on the mend."

"And so I say for all our troubles, midterm finds this administration and this country entering a season of hope," Reagan said in reviewing his performance and giving it high marks in a session with reporters in the White House briefing room. He then answered questions for 15 minutes.

Reagan brought a 118-page assessment of the first two years that was as upbeat as was the president. But even in this document, chock full of statistics and lists intended to show Reagan successes, there were hints of the difficulties the administration has encountered.

The essence of Reagan's defense of his performance to date, after a 1980 campaign in which he promised to balance the federal budget and bring prosperity to the nation, was that the economic situation when he took office was much worse than he had believed at the time.

"My biggest regret is that because the accumulated damages piled up so high for so long, putting America's house in order has been a tough and painful task," Reagan said.

"I remember John Kennedy saying that when he came into office, the thing that surprised him most was to find that things were just as bad as he'd been saying they were. In my case, the biggest surprise was finding out that they were even worse."

Nonetheless, the president claimed great achievements in efforts to build the defense budget and "undo the damage that the overtaxing, overspending, overregulating binge of the '60s and '70s inflicted on the American way of life."

Though Reagan also took credit for items that were not part of his original program--such as the combined tax increase and benefit reductions that are at the heart of the Social Security compromise he and Democratic congressional leaders have agreed to--he acknowledged no fundamental changes in his program.

Asked if he would have done anything differently, Reagan replied jocularly, "Well, I could have demanded a recount." Then he said that he "cannot think of anyplace where we would have changed courses drastically."

Reagan borrowed the recount line from his friend, William F. Buckley. It was Buckley's response when he was asked after his defeat in the 1965 New York mayoralty election what he would have done if elected.

Many of the questions centered on Reagan's policy toward the Soviet Union, especially his remarks early in his administration about the perfidy of Soviet policies. Reagan defended these remarks and his policy of military buildup, saying that this was the best way to get the Soviets to negotiate on arms control.

He also expressed the view, as he has in the past, that the Soviets will be serious about negotiating arms control agreements "because we believe that the Soviet Union has some problems of their own that have to be resolved."

Reagan also referred to what he called "the Ten Commandments of Nikolai Lenin" as proof that communists believe it is proper to lie and cheat to further their cause. Soviet specialists said there is no known set of Lenin "commandments."

The president appeared to be relaxed and occasionally in a combative mood yesterday as he was peppered with questions inviting him to compare his record with his promises.

Reagan's top four staff members had scheduled a briefing for reporters on the administration at midterm, but Reagan appeared instead because the aides said they feared their appearance would seem to overshadow the president.

After the brief news conference had been formally ended by White House spokesman Larry Speakes, the president answered one last question, whether he was concerned about being identified as too much of a moderate.

"I have to say you must be doing something right when you're getting rocks thrown at you from both sides," Reagan replied with a smile.

The midterm appraisal Reagan brought is entitled, "The Reagan Presidency: A Review of the First Two Years" and describes the second year as "a time of testing and transition."

"Acting forcefully and fairly, President Reagan had averted the calamity-in-the-making which greeted him when he took office," it says. But "by the end of 1982, grave problems of unemployment remain and a deep recession had driven up federal budget deficits to levels that demanded fresh attack."

Michael E. Baroody, the White House director of public affairs, who supervised preparation of the report, said it was designed to highlight Reagan's accomplishments. The volume opens with the warning that it "is not intended to be a comprehensive look 'warts and all' " at the first two Reagan years.

In fact, very few of the "warts" are mentioned.

For example, in a review of Reagan's legislative record, the report maintains that the president "proved" he could work with Congress. But in a list of "key votes" last year, no mention is made of the jolting setback Reagan received in last December on the MX missile.

The report concedes "there were frustrations" in working with Congress. These are laid at the doorstep of Capitol Hill and not on any shortcomings in the White House. The report also absolves the president of being at fault for rising unemployment during his first two years.

Despite the compromises Reagan has made, including two tax increases since his three-year tax cut was enacted, the report concludes that by the end of last year, "the program remained largely intact."

Beyond the economy, the report says that some aspects of the Reagan years have been unqualified successes. For example, Reagan made the Cabinet "much more of a working reality" and he "began to fulfill his commitment to federalism."