The House Ways and Means Committee voted 20 to 14 yesterday to end the federal income tax deduction of statee and local gasoline taxes the year after next.

Also nailed into the tax part of President Carter's energy-saving package by a vote of 20 to 17 was a tax credit of up to $400 to cover part of the cost of insulating a home.

Repealing the state gas tax deduction would affect about 30 per cent of all taxpayers - the 18.5 million who itemize deductions and deduct an average of $37.62 for state gasoline tax payments. The administration had not asked for this provision. The committee tentatively approved it nearly three weeks ago on the day it killed Carter's request for a standby tax on gasoline that could have gone to 50 cents a gallon over 10 years. It would take effect with returns on 1978 income filed in 1979.

Rep. William M. Ketchum (R-Calif.) tried to strike the repealer because the administration conceded the petroleum savings would be very little, only 70,000 barrels a day in a program seeking savings of 4 1/2 million.

But Rep. Joseph L. Fisher (D-Va.) asked: "Why give a tax break for consumption of gasoline?" He said the committee action was an important symbol.

Repealing the state gasoline tax deduction would bring in an additional $700 million in income the first year and more in future years, the committee staff estimated.

Carter's energy program of taxes and rebates was intended to come out even - giving back or spending on other energy-saving programs all the money taken in by the energy taxes. But after tentative Ways and Means Committee actions of cutting back tax proposals, the plan is running in the red. As it now stands the program may take in $20 billion less than it spends by 1985, said Assistant Secretary of the Treasury Laurence Woodworth.

The tax credit of up to $400 to homeowners for insulating their homes had narrowly survived an earlier vote, 13 to 12, but won final committee approval yesterday 20 to 17. It would permit a tax credit of 20 per cent of the first $2,000 spent on home insulation. The administration believes it would save 320,000 barrels of oil a day by 1985.

Rep. Fortney H. Stark (D-Calif.) tried to knock the credit out of the bill. He argued that people should not be paid tax money to do what good sense should tell them to do anyway.

Rep. William A. Steiger (R-Wis.) agreed, arguing that the credit would bring in the "fast-buck boys" to push up prices and push down quality.

But committee Chairman Al Ullman (D-Ore.) said the insulation credit proposal was popular and easy to understand. If the Ways and Means Committee threw it out, it would be put back in the bill at some later stage, he said.

The committee received reports that the insulation industry is now operating at capacity and that planned expansion won't be completed for 18 months. Woodworth urged that the credit be kept in the bill because the pace of insulation needs to be speeded up. The administration estimates the home insulation credits would cost $2.3 billion through the end of 1982 when the program would end.

The committee changed slightly the tax credit for installing solar or wind energy equipment to encourage modest investment, such as installing a $1,500 hot water heating unit rather than a $10,000 unit to heat a house. As finally approved, the solar and wind credit was 30 per cent of the first $1,500 invested and 20 per cent of the next $8,500. That would permit a maximum credit of $2,150.