In a signal that defense may face painful cuts under a pending balanced-budget plan, the House voted yesterday to kill $1.7 billion for the MX missile, then turned and reversed itself only after stunned White House officials warned that the action would damage President Reagan in his summit with Soviet leader Mikhail Gorbachev.

The MX votes took place as the Democratic-controlled House easily passed a defense spending bill that contained one major setback the administration was unable to overcome, a refusal to fund renewed production of chemical weapons.

Lawmakers said yesterday that the initial vote to eliminate all MX missile funds from the fiscal 1986 defense spending bill was the first indication of the tough new scrutiny Congress will begin applying to all programs, even those most favored by the president, if it adopts a plan to force a balanced federal budget by 1991.

"I think every issue now will be debated in terms of Gramm-Rudman," said Rep. Leon E. Panetta (D-Calif.), referring to the balanced-budget plan by Sens. Phil Gramm (R-Tex.), Warren B. Rudman (R-N.H.) and Ernest F. Hollings (D-S.C.) that is being debated by a House-Senate conference committee. "This is the start."

The MX funding was the only major source of controversy in the defense bill yesterday after the White House abandoned an effort to restore $164 million cut by the House Appropriations Committee for renewed production of chemical weapons. Supporters said they did not have the votes to win. The elimination of all funds for chemical weapons was a significant setback for the Reagan administration, which just last spring was able to persuade the House for the first time to end a 16-year moratorium on production of chemical weapons.

The vote then was on a defense authorization bill that approves spending levels for military programs, but does not provide the dollars to fund them.

Yesterday's bill provided the actual money for numerous defense programs, but not chemical weapons.

The overall defense measure was adopted by 359 to 67 and sent to the Republican-controlled Senate for consideration.

The measure, and related legislation, would freeze defense spending for the fiscal year that began Oct. 1 at the fiscal 1985 level of $292.6 billion.

That amount is about $30 billion less than Reagan requested for defense and $10 billion less than provided in the budget plan Congress approved this fall.

On the MX, the House first voted 211 to 208 on an amendment by Rep. Barney Frank (D-Mass.) to eliminate $1.7 billion this year for production of 12 new MX missiles.

Thirty-seven Republicans, many of them from economically hard-hit farm areas, joined 174 Democrats in supporting the amendment. Opposing it were 138 Republicans and 70 Democrats.

About two hours later, under pressure from the White House, the House reversed itself, voting 214 to 210 against the Frank amendment.

Frank argued during debate that the $1.7 billion for 12 additional MX missiles was an unnecessary expense at a time when Congress is grappling with ways to reduce the deficit.

"If we are serious about deficit reduction how can we spend $1.7 billion for 50 MX missiles for which there is no strategic value?" Frank said. "This is the most clear-cut deficit-reduction vote we will have this week."

House Armed Services Committee Chairman Les Aspin (D-Wis.), who supported the MX, said yesterday after the first vote, "It's a nice Gramm-Rudman message. It catches . . . the president's attention."

However, House Minority Whip Trent Lott (R-Miss.) disputed that interpretation, saying MX votes have always been close and Frank simply "caught us distracted. Barney caught us being lax" on the first vote.

The Gramm-Rudman-Hollings plan would force Congress to cut programs to lower the federal deficit by $36 billion a year until 1991, when the deficit would have to be zero. If Congress was unable to make the necessary reductions, the president would be required to propose across-the-board cuts in most federal programs except Social Security.

There is strong disagreement over how the plan would work and how much of the defense budget would be affected. Administration officials maintain that much of defense would be exempt from the cuts. House Democrats have argued the opposite.

Several lawmakers who voted to cut the funds and then switched said yesterday they did so solely because of the special circumstances of Reagan's impending Nov. 19-20 summit with Gorbachev.

Rep. Rod D. Chandler (R-Wash.), who has supported the MX in the past, said he first voted against it yesterday "for deficit reasons," but switched after White House lobbyist M.B. Oglesby telephoned to say that "this position would really be damaging to the president in the arms control talks. I didn't want to be in that position."

Rep. James Ross Lightfoot (R-Iowa), who supported the MX in the past but voted against it this time said he did so because of the deficit and because Reagan has "chosen to ignore" the economic problems of farm areas.

"The best way to send a message to someone is to steal one of their favorite toys," Lightfoot said.