Westinghouse Electric Corp. has agreed to pay Virginia Electric & Power Co. $361 million in cash and uranium to settle a long legal battle over fuel for Vepco's nuclear power plants.

The settlement was announced yesterday in Richmond, where the case has been on trial before U.S. District Court Judge Robert R. Merhige, Jr.

Merhige issued a gag order preventing either company from commenting on details of the settlement.

The agreement, as detailed in announcements approved by the court, calls for Westinghouse to pay Vepco:

$128 million in cash during 1979 and 1980.

7.5 million pounds of uranium-worth $136 million at current prices-between 1980 and 1994.

$73 million in "other goods and services" required by Vepco over the next 10 years.

An additional $44 million if Westinghouse is successfull in a uranium ore price-fixing case it is bringing against a group of producers.

Westinghouse said the Vepco deal is the seventh of 17 lawsuits against the company over nuclear power plant fuel to be settled.

The utilities sued Westinghouse after the company in 1975 cancelled all its contracts to supply nuclear fuel. Citing the legal dectrine of "commercial impracticability," Westinghouse said it could not fulfill the contracts because the Arab oil embargo and uranium price fixing had inflated the cost of the fuel artificially.

After an 88-day trial with 382 witnesses, Judge Merhige rejected Westinghouse's arguments last October and ruled the company was liable for its nuclear fuel contracts.

Rather than hold a trial on the amount of damages due Vepco, Merhige referred the dispute to a special master, Dean William E. Spong Jr. of the Marshall-Wythe School of Law at the College of William and Mary. The settlement negotiated by Spong was announced yesterday by the two sides. The agreement still must be ap proved by the boards of directors of both companies.

Westinghouse said its cost of the settlement would be substantially less than the value of the deal to Vepco. Westinghouse estimated its obligations at about $200 million before tax credits.

Vepco officials noted that the agreement was based on the value of the 11.45 million pounds of uranium that Westinghouse had contracted to provide the Virginia utility company.

Uranium fuel prices jumped from the $8 to $12 price range before the Arab oil embargo to more than $40 a pound afterwards.