Anyone who drives in the District of Columbia knows the problem first-hand: Morning rush-hour traffic backs up at lights still flashing red and yellow from the night before. Lights stick on red or are dead. Lights are out of sequence with those at adjacent intersections for months at a time.

D.C.'s traffic signal system was among the best money could buy when installation began in the late 1950s. Today, switches in those battered gray control boxes on street corners are worn and prone to jamming. Cues sent by radio are often missed by receivers full of improvised spare parts. Many signal boxes are so beat up that inspectors have trouble opening them. And the system's manufacturer stopped making the line years ago.

The city's traffic engineering chief, Seward Cross, spends much of his working day cruising the streets in a Chevrolet van to watch his troubled lights in action. He describes the system as "held together with masking tape and baling wire."

All in all, signals at the District's 1,250 controlled intersections often create traffic tie-ups rather than clear them up.

But relief may be in sight, D.C. Transportation Department director Tom Downs said. Early next year, the city plans to solicit bids for a design contract, the first step toward computerizing the nervous system that ties all the lights together.

A recent consultant's study concluded that the quickened traffic flow that computers would bring would save D.C. drivers and passengers more than 21,000 hours of traffic jam delays daily and 3 million gallons of fuel per year.

There would be other benefits. The air would be cleaner and there would be fewer traffic accidents because fewer lights would fail.

And to match green and red to actual traffic, engineers seated in a control room could manipulate timings for lights at specific intersections, something they can't do today even when the system works right.

Because of these and other advantages to a computerized system, many large U.S. cities -- New York, Los Angeles and Miami, for instance -- are already at work on similar plans.

In the District, the system's bulky mechnical components would be replaced with more versatile and reliable solid-state materials. Full installation could come five years after design begins, assuming there is enough money. That is the catch: In this period of budget cutting, the program depends on federal grants covering most of the estimated total cost of $34 million. About $1.7 million has been secured for the design; nothing is certain after that.

The District's record in Congress in the Reagan administration's first year is not encouraging. For the current fiscal year, city officials had expected $40 million in one transportation program that might finance the lights but tentatively have come out with only $9 million.

For the present, then, drivers are stuck with what they've got. No doubt more surprises lie in store like one that sprung up on a rainy morning rush hour early this month.

Lights on Capitol Hill and in eastern downtown suddenly went haywire, some showing green and red simultaneously, others lighting up only halfway. "That's not supposed to happen," said Cross, who reached the scene at about 7 a.m. and couldn't believe his eyes. " . . . I was pulling my hair out that morning."

The culprit, it turned out, was water that soaked into a trunk cable that had been spliced over and over. The malfunction, which affected about 150 lights, was corrected a few hours later and traffic returned to normal.

That was an extreme case, but statistics bear out what drivers have long suspected: the lights go awry routinely. Recent surveys found 18 percent of them on a wrong timing sequence during morning rush hour, 21 percent during evening peak. Twenty percent of the lights programmed to flash late at night did not do so.

Here's how today's system works, when it does work:

Each intersection's brains are inside its control box, the gray streetside cabinet that is often plastered with ads and political posters. The switches that pedestrians hear clicking and thumping inside as lights change can be set to create three basic patterns -- morning rush-hour, which gives lots of green to traffic going downtown; outbound rush, which does the opposite, and off-peak, which balances out-bound and in-bound traffic.

Mechanics set each intersection's box individually, to match its local traffic volumes and its own mix of left-turn arrows, pedestrian crossing signals, etc. This job can be especially tricky in Washington, thanks to city designer Pierre L'Enfant, who laid avenues diagonally across a grid, creating circles and many five- and six-sided intersections.

To know precisely when to move between peak and off-peak timing sequences, lights rely on radio tones broadcast by a transmitter at Fort Reno Park, off upper Wisconsin Avenue.

Receivers at about 40 "master" intersections around the city -- these are distinguished by the antennae atop their control boxes -- pick up and interpret these signals for themselves and a collection of "slave" intersections that each controls though cable links.

At 6 a.m. every weekday, for instance, a tone is broadcast that masters interpret to mean "move to in-bound rush sequence." They do that and order their slaves to follow suit. At 9:45, another broadcast tells them to switch back to off-peak mode. At 3:30 radio orders go out to begin the evening rush pattern, which is shut off at 6:45.

Other tones switch on no-left-turn signs and one-way arrows at selected intersections at rush hour.

Still other tones act like the beats of a symphony conductor's baton, keeping the 1,250 intersections in time with each other cycle by cycle. Though it may seem longer, most lights take 80 seconds to go from green to yellow to red and back again.

This synchronization allows neighboring lights to be set so that cars can pass through a succession of greens without stopping. The D.C. Transportation Department, in fact, has an engineer who does little else but put pencil to paper to devise ways to give the longest green to the largest number of vehicles.

When everything works as it should, says traffic engineering chief Cross, the motorist leaving Georgetown at the start of the evening rush hour can drive without a stop to Annapolis (the route to follow is Pennsylvania Avenue-L Street-New York Avenue and on out).

Unfortunately, it's the rare day indeed when everything works as it should.

The system's manufacturer, Motorola, discontinued the line after the District's system was installed in the late 1950s and early '60s, and spares are no longer being made for many devices in use. Collisions and the weather continue to take their toll. "If we lose a receiver during an accident, we can't replace it," said John McCracken, manager of the computer project.

When word arrived recently that Pittsburgh might scrap its Motorola system, the District placed a phone call to ask about buying the junk for spares. New Haven, Conn., meanwhile, having heard of the District's computer plans, has called here with the same question.

In the meantime, the technicians make do. If one master's receiver is lost, street crews might rewire its lights to link them to another master, or a receiver might be pulled from some less important master and its slaves tied in elsewhere.

Radio signals are an especially weak link. The main transmitter at Fort Reno is in such poor shape that it was recently found to violate federal standards on frequency deviation. Interference from such things as birds and trucks can make receivers miss their cues altogether, throwing whole parts of the city out of synchronizaton.

At the same time, an official said, city budget reductions have helped to push maintenance staff devoted exclusively to lights from about 15 to 7 people. Minor problems are left unrepaired for weeks; preventive maintenance is put off as well. The result is the chronic failure motorists know well, according to city officials.

Cross said that going with computers would reduce failures by substituting modern solid-state circuitry for the worn mechanical components now in the control boxes. Radio would be abandoned altogether, replaced by wires strung to each intersection through Pepco's underground conduits.

Lights that did fail could be repaired more quickly because their control devices would report to the computers immediately if things went wrong. (The computer program also provides for a larger maintenance staff.) At present, the Transportation Department learns of failures only when policemen or citizens report them.

On normal days, a computer would direct the light cycles on a fixed program worked out in advance. But if necessary, control room engineers could override that program, manually ordering timing changes at specific intersections to clear unusual jams, caused by an accident or a parade, for instance.

The District has opted against more complex systems on the market in which sensors buried in city streets continously report actual traffic levels back to a computer, which on its own decides when to switch from timing to timing. "I wanted proven technology," transportation chief Downs said.

If the plan does go forward, not much of the new equipment will be visible to the motorist. The lights themselves, standing atop the familiar gray poles, would not be replaced, only the brains that tell them what to do. The biggest change that motorists would see, Seward Cross says half seriously, is that "everybody gets a green light."