President Reagan today ran into an unexpected burst of skepticism about his defense budget when students at St. John's University here applauded the suggestion that he cut Pentagon spending.

Climaxing a day in which he celebrated the nation's economic recovery by ringing the opening bell at the New York Stock Exchange, Reagan was launching into criticism of Congress on defense spending before an otherwise enthusiastic crowd of 7,000 at the nation's largest Catholic university.

Those lawmakers who want to cut defense "know that it is in the nature of a peaceful democracy not to want to spend money on weapons for defense but to prefer spending that money on social programs," Reagan said.

A wave of applause rippled through the steamy gymnasium. "And so they say," Reagan continued, "if you really want to control spending, then cut defense."

There was another round of clapping followed by some boos for this line, which Reagan intended as criticism of Congress.

Seeming surprised, Reagan responded, "All right. I see you're divided in that, and I can understand because you've been treated to a drumbeat of demagogic propaganda with regard to that."

Reagan defended his Pentagon buildup but said he is "willing to consider more defense savings in noncritical areas" in a compromise with Senate Republicans. However, he said again that he would not consider cuts in areas "vital to our security."

The applause for defense cuts appeared to be the only discordant note during a six-hour foray to New York that White House aides had set up as a picture-oriented celebration of the economic recovery against a tableau of Wall Street and cheering college students. Reagan received an honorary doctor of laws degree from St. John's.

At 9:59 a.m., with chief of staff and former Merrill Lynch chief executive Donald T. Regan at his side, Reagan rang the opening bell on the New York exchange, saying to thundering cheers, "We're bullish on America."

"With tax reform and budget control, our economy will be free to expand to its full potential, driving the bears back into permanent hibernation," Reagan said. "That's our economic program . . . . We're going to turn the bull loose."

The traders jockeyed shoulder-to-shoulder a few minutes later for autographs with pleas of, "Hey Gip, over here Gip."

Later, conferring with Wall Street executives, Reagan said his chief of staff "tells me this is where I can say the word capitalism right out loud." Asked by a reporter whether he had bought any stocks, Reagan said, "I can't buy anything. I'm in a blind trust."

In tone, Reagan's speeches today seemed directed at how his presidency will be remembered. He said U.S. allies and trading partners should follow his example and "throw off the dead weight of government -- cut their own tax rates, spending and over-regulation . . . "

He extolled what he called the "age of the entrepreneur" and told the students, "I am no longer young, as you might have suspected. The house we hope to build is one that is not for my generation, but for yours. It is your future that matters."

The president also offered a prayer for the St. John's basketball team in its semi-final contest Saturday with Georgetown University. In the prayer, which Reagan recalled from his college football days, he said "you can't ask God to help you win," but appealed for no injuries, that the best team win and for "no regrets when the game is over.