The House Ways and Means Committee yesterday approved the Reagan administration's proposed 5-cent-a-gallon increase in the gasoline and diesel tax to pay for rebuilding highways, bridges and transit systems.

Steep tax increases on heavy trucks were also adopted, after hours of negotiation involving Transportation Secretary Drew Lewis, Ways and Means Chairman Dan Rostenkowski (D-Ill.) and committee members Sam M. Gibbons (D-Fla.) and Barber B. Conable Jr. (R-N.Y.).

The agreement would lower somewhat the highway use taxes first proposed by the administration for the heaviest trucks. It would postpone the effective date of truck taxes and tire tax changes until Jan. 1, 1984. Other taxes in the $5.5 billion package, ticketed for the Highway Trust Fund, would take effect next April 1.

Bennett C. Whitlock Jr., president of the American Trucking Associations, called the agreement unacceptable. He said the total taxes on a typical 18-wheeler would increase from $1,746 to about $4,000 a year. Under the administration's original proposal, the total would have been almost $5,000. The difference would be made up by heavier fees on lighter trucks, Lewis said.

Ways and Means approval was in question when the markup session began in late afternoon because of a bizarre jurisdictional matter involving important members of both the Ways and Means and the Public Works committees.

Gibbons announced as the markup session opened that he would oppose the legislation unless a buy-American provision were stricken from a bill passed by Public Works.

Rostenkowski told Gibbons that the Public Works bill was not before Ways and Means, but Gibbons was adamant, insisting that buy-American provisions affected trade and trade was the province of Ways and Means, not Public Works.

Lewis intervened with his fellow Pennyslvania Republican, Rep. Bud Shuster, author of the buy-American provision. After a recess, Lewis told Ways and Means that Shuster had withdrawn the provision.

"Mr. Shuster is a statesman," Gibbons said.

The central issue in the Ways and Means deliberations was who would pay the proposed new taxes and who would be exempt. Taxicabs lost and schools buses and farmers won.

Taxis currently pay no federal tax on the diesel fuel and gasoline they use, while truckers and automobile drivers pay 4 cents a gallon. Committee action would maintain the 4-cent exemption for the cabs, but would force them to pay 5 cents a gallon while everyone else would be paying 9 cents.

Several committee members expressed concern that a tax on taxicab fuel would result in fare increases, but their attempt to grant a total exemption was defeated by a show of hands, 12 to 11.

Intercity buses, including Greyhound and Trailways, also pay no diesel tax and also were threatened with a 5-cent tax in an early vote. But in the evening the committee reversed itself, 18 to 12, and exempted the bus companies.

Local transit buses and privately owned contract school buses, which for the first time would have had to pay a 5-cent-a-gallon tax under the administration proposal, were also exempted. Farming interests, generally exempt from fuel taxes, held onto their exemptions in votes, as did state and local governments.

The committee room was packed with lobbyists from the many transportation interests potentially affected by the bill. Lewis' appearance to take questions at the markup session was the first time a Cabinet officer has done that since treasury secretary William E. Simon in the Nixon and Ford administrations, a committee staff member said.

In a related action, the Senate voted yesterday to allow 8 1/2-foot-wide trucks -- 6 inches wider than currently allowed--on the nation's highways. The provision is part of an $11.6 billion appropriation bill for the Transportation Department and related agencies.

The House version of the bill contains no such provision, although rules permitting wider, heavier trucks are part of the administration's proposed gas-tax package as a trade-off for the higher use taxes.