A federal judge in Alexandria yesterday short-circuited a Virginia congressman's efforts to win a lucrativeship-overhauling contract for his home district.

But two hours later, Rep. Paul Trible (R-Va.) took his case to Richmond, where federal appeals court Judge John Butzner issued a temporary injunction barring the Navy from awarding the contract to any other location until the case can be heared by the full U.S. 4th Circuit Court of Appeals.

The dispute is over the aircraft carrier Saratoga, which is due for a multimillion dollar overhaul.

Trible wants the work done in Newport News, Va. which lies in his congressional district. But the Carter administration, to fulfill a campaign pledge, wants the overhaul done at the government-owned Philadelphia Navy Yard.

The contract would provide more than 2,000 jobs for a 28-month period, according to Trible.

"This is a political issue," said U.S. District Court Judge Albert V. Bryan Jr. in refusing to hear Trible's suit against the Defense Department. "This is a quarrel between the legislative and the executive branch."

Bryan said Trible, as a congressman, lacked proper legal standing to bring the suit, which the judge said related to "policy and administration of government . . . an area the judiciary ought to stay out of."

But Trible after the unusual 30-miniute hearing in which he acted as his own attorney, appealed by telephone to the 4th Circuit and won the temporary injunction from Butzner. Motions will be filed on Tuesday in the U.S. Court in Richmond and a spokesman for Trible said a judicial panel would rule shortly on the case.

Trible is seeking to prevent the Navy from beginning work on the Saratoga until mid-May, when he hopes to persuade Congress to direct the Navy to award the contract to the privately owned Newport News Shipbuilding and Drydock Co.

A General Accounting Office study has determined that it would be $100 million cheaper to repair the Saratoga at Newport News than at Philadelphia. The aircraft carrier is the first of four scheduled for rehabilitation under the Navy's Service Life Extension Program (SLEP).