Energy officials in the Washington area have agreed to a standby gasoline sales plan that would prohibit motorists in times of shortages from buying less than $5 worth of gas for their cars.

The minimum, designed to prevent long lines at service stations caused by people wanting to "top off" their tanks, is part of standby, odd-even gasoline sales system tentatively adopted by Maryland, Virginia and the District of Columbia.

Although executive orders are being drafted to set up the machinery, officials said there are no plans to invoke restrictions at this time.

Details of the plan were disclosed yesterday as Virginia announced it had joined in the tentative agreement, already by Maryland and District representatives. It is still subject to review by the Virginia governor's office, a spokesman said.

The gasoline sales plan would apply to private aircraft and boats as well as to automobiles. It also would apply to diesel fuel.

In addition to setting restraints on gasoline sales, the joint plan provides for conservation of electricity, including the possible shutting off of decorative and advertising lights on private and public buildings.

It also calls for setting thermostats no lower than 80 in summer and no higher than 65 in winter in public and private office buildings. Maryland and Virginia already have set controls for state-owned buildings, and the District is expected to follow suit.

Maryland, Gov. Harry Hughes will ask a legislative review committee next week to approve a proposed executive order that would not such controls into effect in private office buildings, the governor's press office announced.

Yesterday's agreement followed recent announcements by Hughes and Virginia Gov. John N. Dalton of statewide energy-saving programs, including strict enforcement of the 55-mile-an-hour speed limit and curtailment of government travel.

Mayor Marion Barry said he plans to announce his own energy-saving program next week, affecting both the public and private sectors.

The odd-even system keys the sales date to the last digit on a motorist's license tag, with all-letter tags counting as even numbers. The method was used here during the 1973-74 Arab oil embargo, and recently went into effect in California.

Saturdays, Sundays and holidays would be open sales days, with gasoline available to everyone.

Motorists with tags from outside the region could buy without regard to the odd-even system, but would be limited to eight gallons at a time.

The minimum purchase of $5 would be applied to all local automobiles with one exception. Stations short on gasoline supplies could decide on their own to sell no more than a set amount - less than $5 - to all customers. Motorcycles and mopeds would be exempt from the minimum at all times.

The $5 minimum is designed to prevent long lines and to discourage motorists from hoarding gasoline by always keeping a full tank.

Emergency vehicles, government owned cars, funeral hearses, school buses, taxicabs, trucks, van pools and long-distance travel by judges and jurors would be exempted from the odd-even sales.

The plan does not contain a specific trigger under which the restrictions would be invoked.

"It is assumed," the agreement says, "that the necessity of imposing mandatory . . . restrictions will be occasioned by public demands . . . and demonstrated need as evidenced by long lines or other consumer inconvenience."

If the governor of either state of the mayor of Washington judges an emergency to exist, he would notify the other executives at least two days before issuing an order The executive director of the Metropolitan Washington Council of Governments (COG) would coordinate needed actions regionally.

A spokesman for Dalton said Virginia would expect to impose any restrictions statewide, not just in the Washington area.

The new plan was negotiated under an agreement signed by the two governors and the major at the COG meeting on March 21. It was designed to avert the kind of situation that occurred early in 1977 during a natural has shortage, where stiffer restrictions were imposed on the Virginia suburbs than on the rest of the region.

Charles H. (Chuck) Clinton, the District's energy coordinator, said proposed executive orders providing for electricity cutbacks are undergoing legal review before being proposed to the major.