With thousands of elderly demonstrators lining the Capitol steps, the House voted overwhelmingly yesterday for what Republicans immediately portrayed as a "meaningless" gesture aimed at retaining the $122-a-month minimum Social Security benefit.

But as the House, in a 405-to-13 vote, made its largely symbolic bow to the 3 million recipients of the minimum benefit, the Senate voted 52 to 46 against amending the administration's tax bill to lock the imperiled benefit into law, thereby reaffirming its position.

At the behest of President Reagan, both houses voted last month to eliminate the benefit as part of their omnibus legislation cutting domestic spending by nearly $40 billion for next year. But there have been second thoughts recently, and Democrats seized upon the mounting anxiety to try again to preserve the benefit.

They failed outright in the Republican-controlled Senate, where the amendment sponsored by Sen. Donald W. Riegle (D-Mich.) went down to a party-line defeat. But they claimed victory in the at least nominally Democratic House, although GOP leaders disputed the claim. l

House Minority Leader Robert H. Michel (R-Ill.) denied the Democrats a clear-cut victory -- and possibly saved the administration from defeat -- when he called on Republicans to vote for the nonbinding resolution on minimum benefits as a matter of political oneupsmanship.

While defending the administration's position that it only wants to get rid of an "unearned benefit" that goes largely to those who don't need it, Michel said the issue on the House floor was merely politics.

"The only thing to be decided on the floor today is who will keep the advantage in the biddig war over the Social Security issue," Michel declared, adding that he was not about to let the Democrats "ride the Social Security issue to political paradise at our expense."

The Democrats, however, contended that the minimum benefit was needed by hundreds of thousands of desperately poor old people -- or as Sen. Russell B. Long (D-La.) put it during the debate, "these dear old people, including the nuns," who would lose at least some income if the benefits is eliminated.

House Speaker Thomas P. (Tip) O'Neill Jr. ( d-Mass.) discounted Republican claims that the vote was meaningless.

The administration, failing in efforts Monday to round up votes against the Democratic resolution, was "rebuffed so badly by so many Republicans that Michel advised them to back off in a hurry," according to O'Neill.

Reagan intervened personally Monday with a letter to congressional leaders of both parties that denounced Democratic tactics and disclosed that he will seek time on nationwide television to call for a "bipartisan" solution to the system's financial problems.

This apparently put Michel in a bind. Although the Democrats needed a two-thirds vote to pass the resolution and have been unable to muster even a majority against Reagan's budget, Social Security was clearly their best issue. So Michel punted.

Administration officials "are free to express themselves any way they want to," Michel told reporters, "but we are an independent body here." He denied being angry with the White House, but said he believes the administration misplayed the Social Security issue with a "premature" set of proposals for cutbacks that went beyond elimination of the minimum benefit.

The resolution approved by the House, proposed by Majority Leader James C. Wright (D-Tex.), urges that "the necessary steps be taken to insure that Social Security benefits are not reduced for those currently receiving them," including minimum-benefit recipients.

Wright originally proposed that the benefit be restored by the House-Senate conference on the spending cuts bill, even though both houses voted to eliminate them and bipartisan leadership "understandings" for the conference appeared to rule out such a move.

Conference action on the issue is considered unlikely, and it was unclear yesterday what effect the resolution, which has no legal force, may have on future legislation. Rep. J. J. Pickle (D-Tex.), who heads the Ways and Means subcommittee that deals with Social Security, said he thought his panel should reaffirm its earlier position that the benefit be phased out for future recipients only. i

In relatively brief House and Senate debates, views differed sharply over how many people would be hurt by killing the minimum benefit. "We're not talking about a group of merry widows who clip coupons by day and waltz by night," said Rep. Patricia Schroeder (D-Colo.). "These are unearned benefits to non-needy citizens," countered Rep. Phil Gramm (D-Tex.), a conservative who joins the Republicans on budget issues.

Meanwhile, several thousand demonstrators organized by the National Council of Senior Citizens gathered in sweltering heat on the Capitol's west steps to hear and cheer O'Neill, Sen. Edward M. Kennedy (D-Mass.) and other Democrats denouncing Reagan's proposed Social Security cuts. One demonstrator's sign said "Congress -- When My Security Goes, You Go.

In a related development, the Senate Democratic Caucus approved a resolution calling on the Senate Finance Committee to draft a bill within 10 days to solve the Social Security system's immediate financial problems by authorizing borrowing from among its trust funds. The resolution, proposed by Sen. Jim Sasser (D-Tenn.), also calls for Senate approval of the plan before its August recess.

Elsewhere on the budget front, Associated Press reported that House and Senate conferees agreed to tighten eligiblity requirements for guaranteed student loans, which presently are available to students from families from all income levels.

Under a compromise agreed to after hours of wrangling, students from families with incomes of $30,000 or more would have to meet a needs test formulated by the secretary of education.

Republicans on the budget conference committee beat back a Democratic attempt to write a needs test into the legislation which, among other things, would exclude the family home from listed assets.

But members agreed to express their concern on this point in the legislative report and to subject whatever needs test the secretary formulates to a possible one-house veto.

The conferees also agreed to a 5 percent origination fee for guaranteed student loans. At present, there is no such fee.

And Senate conferees agreed not to phase out an education program for Vietnam veterans, but to authorize $36 million for three years.