President Reagan last night urged Republican members of Congress to campaign for reelection this year by blaming economic troubles on the "mess" he said they had inherited from the Democrats.

"Let's go to the American people," the president told a Republican fund-raising dinner at the Washington Hilton Hotel. "Let's remind them of the economic mess we inherited when we took office."

Speaking to a campaign dinner that raised an estimated $3 million for Republican congressional candidates, many of whom are expected to face a tough challenge in this year's mid-term elections, the president defended his embattled economic program and said it was the Democrats who would have to take responsibility for encouraging spending increases and opposing further income tax reductions.

Reagan also indicated that Democratic advocacy of decreases in his military budget would be an issue, saying that the Democrats want to conduct "a bargain-basement fire sale on national security."

Many Republican congressmen also have advocated reductions in the Reagan defense budget, and the president supported a $28 billion decrease in military spending as part of a proposed budget compromise that collapsed last week after face-to-face negotiations between Reagan and House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.).

Reagan's partisan comments, interspersed with many one-liners, were delivered without any display of rancor and without mentioning any of his Democratic adversaries by name.

In an uncharacteristic move, the White House issued no text of Reagan's speech, and made no attempt to publicize its contents. One administration official said that Reagan was trying to play down partisanship at this time in his public statements, while he is still hoping to reach some budget compromise.

Nevertheless, the outlines of the 1982 campaign were apparent in the speech: to portray the Democrats as the party of "spend and spend and elect and elect," and the Republicans as their responsible opposition, trying to change the course of the country after decades of uncontrolled government growth.

Reagan also denied, as he has in almost every recent speech, that his policies favor the wealthy. Republicans, he said, are not the party of the rich, adding, "We're the party that wants to see an America in which people can still get rich."

In mid-term election years, politicians tend to turn to themes that worked for them in previous campaigns. Reagan is no exception.

Increasingly, he has blamed past Democratic policies for the deficits plaguing his administration. Increasingly, he has returned to his campaign view that the nation's military budget has to be increased sharply to keep pace with the Soviet Union.

Yesterday Reagan used a NATO study showing that the Warsaw Pact has a growing margin in conventional forces to reiterate his view that a U.S. military buildup is needed.

"The president believes strongly that the reversal of this dangerous trend is essential if we are to safeguard the interests of the United States and its allies and to provide the incentive to the Soviet Union to negotiate a stable military balance at reduced levels of force," Speakes said.

Another campaign theme of Reagan was his belief in school prayer.

"God isn't dead," Reagan liked to say in his campaign talks. "They just won't let us pray to Him in the schools anymore."

On Thursday the president is to appeal once more to the school-prayer constituency, this time in the White House Rose Garden. There, according to administration officials, he will propose a constitutional amendment that would allow voluntary prayer in public schools.

More than a dozen such amendments are pending in Congress. The officials did not say which version Reagan would support.

The amendment, if ratified, would undo a 1962 Supreme Court decision holding that recital of an official state prayer by public-school pupils is an "establishment of religion" forbidden by the First Amendment.