As the nation's big-city mayors intensified their attacks on President Carter's budget yesterday, the chairman of the House Budget Committee told them, in effect, not to expect much from Congress this year.

Rep. Robert N. Giaimo (D-Conn.) warned the mayors not to look to the military budget to provide extra funds for urban programs.

"If you think we're going to get an awful lot of money out of the defense appropriations subcommittee or out of the House of Representatives, then you don't know the House of Representatives," Giaimo said.

He also told the mayors, "You're not going to touch [funds for] Social Security, veterans benefits, unemployment compensation or welfare.... That leaves us in urban America out there as the target."

Giaimo offered another bit of bad news when he declared that the general revenue sharing program, which provides $6.6 billion in federal funds to states and localities this year, "is not a popular piece of legislation." The program comes up in 1980.

"If you take a private poll asking members what was the worst piece of legislation they ever voted for, they'd say revenue sharing," Giaimo said. "One reason is that all communities are getting it. Of the 16 cities in my district, I could think of a lot that don't really need it."

Mayor William E. Hanna Jr. of Rockville replied, "To cities, the most popular piece of legislation ever passed is general revenue sharing."

The discussion came as mayros were winding up their 46th annual midwinter meeting here. Earlier they vigorously debated whether a staff analysis attacking Carter's budget was too harsh. Ultimately, they decided it was not and added language that, on the whole, was even more critical.

The staff, led by executive director John J. Gunther, had produced an analysis charging that Carter was backing off his commitment to cities, attacking his drive to cut federal spending as a percentage of economic output and questioning whether trimming the federal deficit will actually reduce inflation.

Albuqurque Mayor David Rusk said the assessment raised questions "about our posture and our credibility." He suggested rejecting it and substituting a "mayors' overview" of the budget that contained more language praising Carter's budget than cirticizing it.

But that effort ran into stiff opposition. Mayors Franklin W. Allen of Spartanburg, S.C., and Janet Hayes of San Jose, Calif., said the strong language of the staff analysis shoule be kept.

Mayor Francis X. McCloskey of Bloomington, Ind., said, "John Gunther had every right to make his remarks." Arthur J. Clark of Waltham, Mass., added, "We should be supportin our staff and not cutting them down."

Finally, mayors who had been appointed to a special subcommittee to consider the staff report voted 10 to 9 not to reject it but to add the mayors' overview to it.

Obviously disgusted by the action, the group's chairman, Detroit Mayor Cloeman A. Young, said, "It means all things to all people." Mayor Paul R. Soglin of Madison, Wis., said it made the mayors "look silly."

After an hour of intense debate in closed session, the conference's executive committee, of which Young is a member, voted unanimously to affirm the staff voerview and not to adopt a separate mayors' assessment. Instead, it added three paragraphs of the mayors' statement to the end of the staff overview.

Those paragraphs repeated poitns in the staff document and contained an extra criticism of the Carter budget's projected rise in unemployment.