Within the next few years the Washington area will have a scenic superhighway of bicycling, stretching from Alexandria to the Blue Ridge Mountains and linking hundreds of miles of hiking, biking and horseback-riding trails here.

Under an agreement signed yesterday to buy an old railroad right-of-way now used only for power lines, the Northern Virginia Regional park Authority will create what officials call the longest and most important bicycle and hiking trail in Northern Virginia.

The 42-mile, 100-foot-wide right-of-way of the Washington and Old Dominion Railroad will be sold to the park authority for $3.5 million under an option agreement signed with the Virginia Electric and Power Co., which now owns the property.

"It's one of the most historic things we've ever done," said Walter L. Mess, founding member and chairman of the 20-year-old park authority. The agency already has preserved more than 7,000 acres of woodland, parks and golf courses in the densely populated Virginia suburbs.

The purchase agreement is a result of unprecedented cooperation among Vepco, state and local officials and represents government recognition of "linear parks" and the "linear" sports of bicycling, jogging, hiking and horseback riding.

"Only six years ago joggers were considered freaks and now . . . like biking . . . it's one of the country's most popular sports," said John F. Herrity, chairman of the Fairfax County Board of Supervisors, who was one of several local officials who jogged or rode bicyles on the trail in the cold rain yesterday to celebrate the purchase ceremony at the Falls Church Community Center.

The Bicycle Manufacturers Association said yesterday there are more than 62,000 miles of biking trails in the U.S., 30,000 of them added since early 1976. Bicycle sales this year are running about 14 per cent ahead of last year, with an estimated 9 million bicycles expected to be sold this year.

The park authority's new trail could be completed within two years if a $1 million federal "Rails to Trails" grant is approved by the Bureau of Outdoor Recreation and within five years if no federal grants are received. It will be bought and developed in half a dozen phases.

The first section to be completed will be between Vienna and Falls Church, spanning the Capital Beltway and the new section of Interstate Rte. 66 on bridges the Virginia highway department has promised to build next year.

That will provide a paved, 8-foot-wide bicycle route from Vienna to downtown Washington. Falls Church built its own bike trail along the W&OD right-of-way two years ago - under a special month-to-month lease agreement with Vepco - and Arlington has paved bike trails along the Four Mile Run Stream valley. The Arlington trail will connect with bike trails now being built by the U.S. Army Corps of Engineeers along Four Mile Run near National Airport.

A fenced or hedged horseback trail will run alongside the paved bike trail from Vienna west to purcellville in Loudoun County, where the W&OD right-of-way ends. Numerous horse trails are being built by the park authority and a 25-mile hiking and horseback trail now under construction along the Occoquan Reservoir and Bull Run also will tie in to the W&OD. "There are now 5,000 horses in Fairfax County . . . that's more than there were in the old days," Herrity said yesterday in praising the W&OD purchase.

One of the crucial political factors in ending the 10-year stalemate over creation of the new park was a resolution the Virginia General Assembly passed unanimously last spring urging Vepco, state highway and other officials to cooperate and conclude the negotiations.

The resolution was sponsored by Del. Raymond E. Vickery Jr. (D-Fairfax) who said at yesterday's ceremony he hoped other rights-of-way around the state can be transformed into parks. "I rode on the right-of-way on my pony when I was a boy . . . and I was one of about 25 who jogged give five miles from Reston to Herndon" during the fall election campaign to demonstrate support for the W&OD purchase, he said.

The W&OD purchase was approved by Fairfax and Arlington county voters in park bond referendums last summer and fall. The final cost of the project will depend on the extent of federal and state aid, but the $3.5 million right-of-way purchase will be apportioned over several years.

Vepco paid $5 million for the railroad property in 1968 and said it is now valued at between $8 million and $10 million. Vepco will maintain its power lines along the right-of-way. But the utility has guaranteed to keep the voltage of the lines below levels that might have an adverse effect on people or animals.

The W&OD Park is expected to be called the Virginia Creeper, as the slow-moving W&OD trains were known. The park will not only consist of the trail itself and its connections with other trails, but it is expected to be the backbone of the Northern Virginia park system since local jurisdictions have been buying parkland along it in anticipation of its purchase.

""Wayside station," renting bicycles and selling snacks will be housed in several of the old railroad stations still standing. Dozens of soccer fields are expected to be built along the route and the park authority is seeking donations of land, buildings or funds for the future park area.