A violent electrical storm roared through the Washington area last night, dumping as much as 3 1/2 inches of rain in parts of Fairfax County in a little more than an hour and generating lightning strikes that set afire more than a score of homes and buildings in the northern and western suburbs.

The slow-moving storm, which took nearly three hours to pass through the area, knocked out power to about 18,000 residents, mostly in Fairfax and Montgomery counties. Local utility companies said lightning was responsible for most of the major power outages.

Although rainfall was heaviest west and north of the District, the rain apparently caused the collapse of a portion of the roadway on Davenport Street NW near Linnean Avenue. Police said the resulting sinkhole in the street was about 20 feet deep and 20 wide.

U.S. Park Police, whose radio communications system was knocked off the air by the storm, said Beach Drive in Rock Creek Park between Broad Branch and Joyce roads was closed because of high water. It was unclear early today whether it would be reopened in time for this morning's rush hour.

Fairfax County fire officials said at least 10 homes in the county were set afire by lightning, but that none appeared to have been seriously damaged. There were no immediate reports of injuries.

Authorities in Montgomery County said a number of houses, businesses and other structures were hit by lightning. Fire officials said the Capitol View-Homewood Recreation Center, at Edgewood Road and Grant Avenue in Kensington, was heavily damaged by a fire after it was struck by lighting about 9:45 p.m. Damage was estimated at about $80,000.

Hundreds of trees throughout the area were downed by winds that gusted up to 30 miles an hour, leaving traffic blocked on many streets and roads. A number of streets in Montgomery and Fairfax counties were also closed briefly by flooding, but all routes were expected to be open by the rush hour, area officials said.

A spokesman for Virginia Electric and Power Co. said about 2,000 residents in the Merrifield area of Fairfax County were without electricity for about four hours before power was restored shortly after midnight. There were also a number of small, scattered power outages throughout the rest of Northern Virginia, the spokesman said.

At the height of the storm, which began moving into the area about 8 p.m., more than 15,000 Virginia customers in Leesburg, McLean, Pimmit Hills and Merrifield were without power for varying lengths of time.

A "few hundred" customers of Potomac Electric Power Co. remained without electricity early this morning, according to spokeswoman Nancy Moses. About 3,100 customers in the Bethesda, Silver Spring annd Takoma Park areas were without power last night for one to two hours, she said.

More thundershowers are predicted for later today, but temperatures in the area are expected to climb only to the mid-80s, in contrast to yesterday's high reading of 90.