The House gave overwhelming final passage yesterday to a package of economic sanctions against South Africa as several conservatives warned President Reagan that any veto effort would probably be overridden.

The 380-to-48 vote came as administration officials reaffirmed their opposition to sanctions as a method of pressuring South Africa to end its apartheid policy of racial segregation. But the officials stopped short of threatening a veto, saying instead that Reagan continues to support "constructive engagement," or low-key diplomatic pressure for change, and would make a decision on the final measure when it comes before him.

In the Senate, conservatives derailed an effort by Sen. Edward M. Kennedy (D-Mass.) "to get some indication of where the Senate stands" through a test vote. The count was 97 to 0 against tabling, or killing, the measure. That meant final action was put off until after the August recess, avoiding a filibuster by conservative opponents. Majority Leader Robert J. Dole (R-Kan.) said eight senators "are prepared to talk at length" against the bill.

As agreed by a House-Senate conference committee Wednesday evening, the bill would ban the importation of the South African krugerrand gold coin, prohibit new U.S. bank loans and nuclear technology transfer, and curb computer sales involving more than $100,000.

The krugerrand ban could be lifted if the president certifies -- and Congress agrees -- that South Africa has achieved at least one of eight measures of progress, such as ending forced relocations, freeing its political prisoners or providing full citizenship rights to nonwhites.

If there is no progress at the end of a year, however, the president would be required to recommend at least one of several additional sanctions, including a ban on new U.S. investments in South Africa, prohibition of uranium and/or coal imports or denial of its most-favored-nation tariff status.

White House spokesman Larry Speakes said the administration had "a number of complaints" about those provisions and opposed "anything that would discourage U.S. investment" on the grounds that business declines harm black workers.

"I think turning away from South Africa and not remaining in contact, to exercise influence, would be the wrong thing to do," Speakes said.

Defense Secretary Caspar W. Weinberger echoed Speakes, saying the United States is "not in a position to make any more enemies as far as countries are concerned." He told the Associated Press in an interview, "We need all the help, all the friends, all the alliances we can put together."

Weinberger compared the white-minority South African government to the late shah of Iran, whose overthrow brought in the Islamic fundamentalist regime of Ayatollah Ruhollah Khomeini.

"I've always tried to take the position that we certainly do not want to do anything to perpetuate conditions that we abhor," Weinberger said, referring to apartheid in South Africa. "But we do have to look at alternatives. And I always keep going back to Iran, where some people a few years ago thought the shah was a very repressive ruler and had a very repressive regime, and paid no attention whatever to the alternatives that would flow from not supporting him.

"And as a result, we have the most repressive government since the Middle Ages in Iran , and that could have been avoided, in my opinion."

The House vote followed ringing calls for an end to apartheid from a broad range of members. Foreign Affairs Committee Chairman Dante B. Fascell (D-Fla.) said "the whole atmosphere changed" in Congress after South Africa imposed a state of emergency July 7, sparking violence.

In a letter to Reagan, seven conservative House members noted that they had opposed sanctions in the first House vote June 5, but supported the final package as "a fair and reasonable compromise" that has bipartisan support in both chambers.

"The persistent and escalating violence in South Africa requires our country to respond immediately to this crisis," they wrote. "We respectfully urge you not to veto this measure because it is an important statement of U.S. policy for the future." They said they would "actively work" to override any veto.

Signers were Reps. Doug Bereuter (R-Neb.), William S. Broomfield (R-Mich.), Newt Gingrich (R-Ga.), Paul B. Henry (R-Mich.), Robert J. Lagomarsino (R-Calif.), Barbara F. Vucanovich (R-Nev.) and Robert S. Walker (R-Pa.).

Rep. D. French Slaughter Jr. (R-Va.) was the only member of the Maryland or Virginia delegations to oppose sanctions. Four Texans were the only Democrats to join 44 Republicans voting no.

In a Baltimore appearance before the National Association of Black Journalists, Frank G. Wisner, acting assistant secretary of state for African affairs, was asked why "constructive engagement" has failed to prod Pretoria toward significant reforms.

"That's how tough the problem is," he responded. "We have an uphill fight before us, but what we have in front of us is a clear set of objectives."