Rep. William A. Steiger of Wisconsin, a rising star in the Republican Party whose successful advocacy of tax-cutting legislation was gaining him a national reputation, died at his home in Washington yesterday following a heart attack. He was 40.

Mr. Steiger, who died in his sleep, was a diabetic, but he had no known history of heart disease, according to Jim Dykstra, an aide. Dr. James L. Luke, the D.C. medical examiner, said the cause of death was a heart attack.

A veteran of 12 years in the House of Representatives, Mr. Steiger came to prominence earlier this year by reason of the "Steiger Amendment" to the Revenue Act of 1978. The amendment would have cut the maximum tax on capital gains from 49.1 percent to 25 percent.

Despite opposition to the measure from President Carter, Congress eventually passed a bill that set the maximum tax on capital gains -- profits from the sale of stocks, bonds, real estate and other assets -- to 28 percent, effective Jan. 1, 1979.

Mr. Steiger made his stand for the cut as a member of the House Ways and Means Committee. He began circulating his amendment early in the year. As concern about taxes and inflation grew in the country, he picked up a number of supporters, including Rep. Al Ullman (D-Ore.), the committee chairman. Sen. Clifford Hansen (R-Wyo.) introduced a similar measure in the Senate and that had strong support from Russell Long (D-La.), chairman of the Senate Finance Committee.

It has been estimated that only about 5 percent of the nation's taxpayers will benefit from the reduction. It also has been estimated that about 79 per cent of the $2.1 billion in savings would go to persons with annual incomes of $50,000 or more.

Mr. Steiger, who was regarded as a moderate among Republicans, asserted that his amendment would benefit far more than the well-to-do.He said it would mean higher stock prices and millions of new jobs. His critics said this was an oversimplification of the relationship between securities and investments and taxes.

His death brought expressions of sorrow from President Carter and other leaders.

"Congressman Steiger, the youngest member of Congress when he was elected in 1966, quickly earned the respect of his colleagues," the President said in a statement. "His energy, independence and good humor will be sorely missed by the people of Wisconsin and by his colleagues."

Rep. Ullman said Mr. Steiger was "one of the finest legislators in the Congress and he had a brilliant career ahead of him. He had a superb sense of the country's mood and worked hard to shape a moderate course."

House Speaker Thomas P. O'Neill (D-Mass.) described him as "one of the brightest minds and one of the most personable members of the House."

Minority leader John J. Rhodes (R-Ariz.) said he "exemplified all that was good in our public officials."

Although Mr. Steiger was best known for his his work on taxes and incentives to investment -- an aide said that he became interested in the capital gains tax when a California inventor testified that he could get financial backing only from Japanese interest -- he had made a reputation on other issues as well.

He played a major role in the passage in 1970 of the law setting up the Occupational Safety and Health Administration.

In 1976, he was a member of the Rules Committee at the Republican Convention that nominated President Ford. He used his mastery of rules to help avert a move that would have allowed delegates originally pledged to Ford to switch their votes to former Gov. Ronald Reagan of California.

At the time of his death, he was devising legislation that would have allowed workers not covered by pension plans a tax incentive to help provide for their retirements.

Mr. Steiger was born in Oshkosh, Wis. He graduated from the University of Wisconsin in 1960 and was elected to the Wisconsin legislature in the same year. He was 28 when he was first elected to Congress in 1966 -- the youngest member of the House -- and his appearance was so boyish that he sometimes was mistaken for a Capitol page. He was a formel national chairman of the College Young Republicans. In 1968, he was named one of the country's Ten Outstanding Young Men by the U.S. Junior Chamber of Commerce.

Survivors include his wife, the former Janet Dempsey, and a son, William Raymond, of the homes in Washington and Oshkosh.