President Reagan yesterday attacked the Democratic-controlled House and Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) in a strongly worded call for prompt passage of the budget cuts and tax reductions he has endorsed.

Reagan criticized O'Neill for saying that the president doesn't understand working people, and said it is "sheer demagoguery" to claim that the administration's economic program isn't aimed at helping workers. He accused some House committees of proposing spending cuts they know cannot be made in order to frustrate his budget-cutting program.

The president held out the threat that if Congress fails to deliver both a budget and a tax bill before the August recess he will use pressure to keep both chambers in session. Only after enactment of these two bills, Reagan said, "can we say as elected representatives that we truly deserve a rest."

Even as Reagan spoke, the House Democrats appeared to be retreating. O'Neill indicated that he would not push for separate floor votes on individual spending cuts, and one key committee acted tentatively to undo some of the actions the president was denouncing.

In an opening statement at his first news conference since March 6, the president stepped up the pressure for quick action on the two bills that form the core of his economic programs. Reagan said his election victory was a mandate for his economic program of less spending and less rapidly rising taxes.

"The people of this nation have asked for action, and they deserve it now, not somewhere down in the misty future," Reagan said.

On the budget, he threatened to support a substitute bill on the House floor if the Democrats tinker too much with the spending goals he endoresed.

On the tax bill, which Democrats are threatening to rewrite in the House Ways and Means Committee, Reagan said he perceives "a gathering bipartisan consensus" for the bill he backs, which would give individuals across-the-board cuts of 25 percent over three years.

"The latest polls that we have show that 79 percent of the people approve of the individual tax cut and approve of it over a three-year span. And that, I think, should be a message to anyone who is elected to office on the Hill or elsewhere," Reagan said.

The news conference was over and Reagan was heading for the door when he heard a shouted question about O'Neill's statement about the president not understanding working people. He returned to the podium and made clear that the speaker's words had stung. The president seemed to want to match childhoods with O'Neill:

"I'm trying to find out something about his boyhood," Reagan said, "because we didn't live on the wrong side of the tracks, but we lived so close to them that we could hear the whistle real loud. And I know very much about the working group."

O'Neill responded that he would never accuse any president of being a demagogue, and that I assume in the future" Reagan "will have the same respect for the speakership." Asked whether his honeymoon with the president, who began his administration by courting O'Neill with White House invitations, is over, the speaker replied:

"Well, I'd have to say the honeymoon is over."

O'Neill said, "The Reagan program speaks for itself." It is geared to the wealthy, he said.

In answer to an earlier question at the news conference, Reagan said, "I've heard these charges about our supposedly being an administration for the wealthy. I don't see where they fit."

He added: "And I believe that our economic package is aimed at stimulating the economy, providing incentive, increasing productivity so as to create new jobs; and those jobs will make it possible for those people who are now economically below the norm to get a foot on the ladder and improve themselves."

The gap of more than 14 weeks between presidential news conferences was partly due to Reagan's convalescence from the March 30 attempt on his life. He was asked whether he is fully recovered.

"I have recovered. I feel fine. And the doctors say I've recovered," he said. "So if I am a medical miracle, I'm a happy one." The president added that there have been changes in security since the shooting, but that "I still want to be able to see the people and meet them." Reagan also said that when he looks back on his political career in light of the shooting, he wonders "why it didn't happen 30 times before."

Gun control, he said once again, is not the way to stop such shootings. The District of Columbia has stiff gun-control laws "and they didn't seem to prevent a fellow a few weeks ago from carrying one down by the Hilton hotel," he said. Such laws, he added, "are virtually unenforceable."

The president looked slightly pale. Some questions he handled effortlessly, but several particularly on foreign policy, caused him to pause and seem uncertain.

On other domestic subjects Reagan said:

He is troubled by negative political campaigns launched by groups such as the National Conservative Political Action Committee before a candidate is even selected to run against the target of the campaign. That is a totally negative campaign "and I've always believed that you campaign by stressing what it is your candidate would do and your approval of it," he said.

Reagan indicated, however, that his troubles are not too large by saying that the NCPAC is going after a group of liberals, not just one. "Just one won't do us much good," he said.

He has not ruled running for re-election in or out. He indicated that his decision will depend in part on how popular he is as a result of actions during his first term.

"Actually, I suppose what I'm saying is the people make that decision. They let you know whether you're going to run again or whether you should or not," he said.