NORFOLK (AP) _ Ordering a new round of bidding to build the second Seawolf submarine, a federal judge ruled the Pentagon changed the ground rules for shipyards vying for the work.

The Navy said it would likely appeal the ruling that came as a stunning setback to the Electric Boat Division of General Dynamics Corp., which had won the contract with a $615 million bid. Electric Boat won the contract in 1989 to build the first Seawolf.

But Newport News Shipbuilding & Dry Dock Co. claimed the Navy had said bids for the second ''fast attack'' submarine would be considered in light of the benefits of establishing a second builder.

Officials of the Virginia shipyard contended their bid should have been accepted because the Navy solicitation stated a preference for a second Seawolf supplier if its bid was below the ceiling price of $708 million.

Newport News shipyard put in a $688 million bid.

''Had the terms of the solicitation been followed reasonably as written, Newport News would have been awarded the contract,'' U.S. District Judge Robert G. Doumar wrote in his 40-page ruling Wednesday.

The congressional appropriation for the second Seawolf made it clear ''that Congress did not intend a pure price competition'' for the vessel, Doumar wrote. The judge said that over the length of the Seawolf program, it would make sense to establish two Seawolf builders to compete for the work.

Newport News could not compete on price alone because of startup costs that Electric Boat had absorbed in its contract for the first Seawolf, the judge said.

However, Acting Undersecretary of Defense Donald J. Yockey rejected the Navy's effort to put two shipyards in the Seawolf program, the judge said.

''The court finds by clear and convincing evidence that for no explicable reason and wholly without rational basis, Yockey arbitrarily and capriciously ordered the SSN-22 (second Seawolf) to be awarded to Electric Boat on the basis of price alone,'' Doumar wrote.

Lawyers for Newport News had sought an order giving the Virginia yard the contract outright, but the judge instead ordered a new round of bids. The parties were given two weeks to submit a resolicitation for approval.

Doumar also continued his injunction preventing Electric Boat from doing work on the second Seawolf until the matter is resolved.

Navy spokesman Lt. Mark Walker said the Navy was reviewing the ruling and would likely ask the Justice Department to authorize an appeal.

''We believe the initial award was proper and that ultimately it will be upheld,'' he said.

At Electric Boat, officials issued a statement saying the judge's decision would be reviewed before a decision is made on what step to take next.

''We believe our bid, which was awarded only after a thorough and exhaustive review by the Navy and the Department of Defense, offered the best in terms of cost and value to the American taxpayer,'' the statement said.