Virginia yesterday won its battle with Illinois to gain what scientists have called the most advanced experimental nuclear-physics facility in the world, after a political wrangle threatened to scuttle the proposed $150 million project.

A proposal to build a National Electron Accelerator Laboratory at Argonne National Laboratory near Chicago was withdrawn yesterday by Sen. Charles H. Percy (R-Ill.) and Rep. John N. Erlenborn (R-Ill.), who informed Secretary of Energy Donald Hodel that Illinois would bow out rather than let the future of the project be threatened by a political battle.

Sen. John Warner (R-Va.) said after an hour-long meeting with Hodel last night that the energy secretary will make a formal announcement today on the selection of the Virginia proposal.

"This is a big step in the decision-making process," Warner said. "I am highly optimistic that the administration will be able to include this in the budget."

"This is good news for Virginia," said Sen. Paul S. Trible (R-Va.), who had lobbied Reagan administration officials to place the facility near his home in Newport News. "It's my judgment we won on the merits. The Virginia option was so obviously superior from a technical standpoint that we prevailed on that basis."

Administration officials privately had warned Illinois officials that continued political fighting over the project could result in no laboratory at all, according to congressional and administration aides. Nuclear physicists from all factions are expecting that some design funds for the long-sought machine will come in the 1984 federal budget.

The Virginia proposal won a design competition and was named best of those submitted to a joint Department of Energy-National Science Foundation committee. The proposal was put forward by a consortium of 23 universities, called the Southeastern Universities Research Association, including four schools from the Washington area and nine from Virginia.

After the SURA proposal won the competition, however, Illinois tried to wrest the project away, triggering an old-fashioned, pork-barrel brawl.

Backers have said the lab could bring $500 million and hundreds of jobs during the next decade to the area that won the facility. It also could help the winning area attract high-technology businesses.

The two states had lined up against each other, with influential Republican congressmen on both sides. They began a lobbying battle on both the White House and Hodel, who received presentations from the contesting sides.

"Senator Percy was prepared to fight to the end if the Argonne board wanted that," said a Percy aide, Howard S. Marks.

Argonne decided not to carry the battle any further "since Senator Percy said a protracted struggle would be harmful to American physics at a time of heavy competition from other nations."

Congressional sources said once the governors, senators and congressmen from each state were locked in the battle, George A. Keyworth, the president's science adviser, and a high-level official at the Department of Energy both informed Argonne that the battle must stop or the project could remain on the drawing board or at least be delayed for years.

Trible and other Virginia officials praised Keyworth yesterday as a "staunch supporter" of the state's proposal.

Last month, Keyworth wrote a letter to House members denouncing a planned amendment by Rep. Sidney Yates (D-Ill.) to block funding for the project.

The amendment would undercut the "framework upon which American scientific preeminence" and placed "local self-interest above national objectives," Keyworth said.

Illinois had objected to some of the things that made Virginia's proposal a winner, including such deal sweeteners as the creation of some 35 new faculty positions in physics, an offer so generous that it could increase by 10 percent the entire field of nuclear studies in the nation.

Illinois also said the Newport News site was clearly second-rate, lacking a major airport and any major university as well as cultural facilities.

The Virginia colleges countered that their design was simply superior. Rep. Herbert H. Bateman (R-Va.), noting the Virginia proposal had been supported by two scientific groups, said, "I suspect there may have been some embarrassment by the scientists at Argonne . . . . Most people who enter a competition don't expect to lose and then receive the winner's prize."

The machine being proposed would be what some have described as a 1,500-foot long racetrack to speed up electrons, and collide them, in order to allow scientists to explore the internal clockwork of the atomic nucleus.