In an important test of strength, the House yesterday approved 17 controversial water projects President Carter opposes, but there were enough votes on his side to sustain a veto.

The unexpected close vote of 214 to 194 to fund the projects crossed party lines and all but guaranteed that the public works legislation will be more to Carter's liking when it reaches his desk.

The key vote came on an amendment to the $10.2 billion public works appropriation bill for the fiscal year beginning Oct. 1.

Supporters of the amendment hailed the tight vote as a defeat for the pork-barrel system by which Congress has traditionally approved projects and a victory for selection of future projects on merit. Both goals had been stressed by Carter in pressing for elimination of projects on his "hit list."

Rep. Silvio Conte (R-Mass.), amendment co-sponsor, said during the three-hour debate that the projects he wanted eliminated owed their existence "less to economic benefits than they do to political clout."

Rep. Toby Moffett (D-Conn), an organizer of support for the amendment, argued "we don't have a merit system" in choosing projects and "this is a golden opportunity to change the system."

The next step for the public works measure is a meeting today of a Senate Appropriations subcommittee. There, an attempt will be made to knock out eight or more of the 17 projects the President wants deleted, along with 12 new construction starts the House added above Carter's requests.

The close House vote should aid subcommittee Chairman John C. Stennis (D-Miss.) in getting some agreement to reshape the House-passed measure more to the President's liking.

Stennis has been working with White House aides and House Speaker Thomas P. (Tip) O'Neill (D-Mass.) in his effort to get senators to accept deletion of some of their projects so as to protect the bill from a veto. A final vote on deletion of projects has been delayed twice while senatorfought to save their own projects.

While the public works bill was being debated, the Democratic House leadership was negotiating with administration officials, attempting to head off another inter-party fight on the Labor-Health, Education and Welfare appropriations bill, which is scheduled for House floor debate today.

The measure contains $1.4 billion more for HEW programs than Carter proposed and he has threatened to veto it if it is not changed.

Yesterday's negotiations involved a compromise on the impact aid program where the House Appropriations Committee added $405 million for a program Carter wanted halted.

According to informed sources at a breakfast meeting, House leaders worked out an agreement with Vice President Mondale in which the leadership would support a move to phase out the impact aid program over the next few years.

In return, the White House would not support moves to cut the figures in the present money bill.

To seal the deal, informed sources said, the President reportedly wanted a letter signed by the key members of the House Education Committee that would handle the impact aid legislation.

Carter aides said yesterday they were suprised by the size of the public works vote. One White House lobbyist said the administration had expected to get only 175 votes.

O'Neill, before the vote was taken, told reporters he did not believe the House could override a presidential veto. Therefore, he said, if a veto occurred he would send the bill back to appropriations Committee to see if more projects could be eliminated to meet the President's objections.

A loser in yesterday's outcome was House Majority Leader Jim Wright (D-Tex.) who directed the defense of the water projects measure.

Wright, in closing the long debate, said the President was practicing "false economy" in trying to eliminate projects on which some $1 billion had already been spent. He attributed Carter's move to "extremely bar advice" and "an unbalanced system of analysis."

Supporters of the measure made unusual accusations on the floor that they were being pressured into voting with the Wright forces by threats that the approriations or Public Works committee would create a "hit list" of their own directed at those who supported the Carter-backed amendment.

Rep. Berkley W. Bedell (D-Iowa) claimed during the floor debate that an employee of the Public Works appropriations subcommittee had called a member of his staff and made an implied threat about a project in his district.

Bedell said later the staff member had been asked to do it by another House member whose name he did not know.

Bedell, who had voted to cut water projects on earlier votes, said yesterday's close vote showed "there was a change coming about" in the House "and people are willing to stand up and be counted."

"This is a victory for people who want to see things run here in an orderly way," Bedell concluded.

Rep. Philip Burton (D-Calif.), who worked hard to line up votes for the water projects amendment, told his colleagues during the debate that "no member should be discriminated against" because of a vote against the Appropriations Committee position.