The District stretch of abandoned railroad spur along the C&O Canal is to become a hiker-biker trail under terms of an agreement being worked out between the Department of the Interior and CSX, the Baltimore & Ohio Railroad holding company that owns the property.

Actual opening of the revamped right of way is still a few years off, but any prospect of the long strip being taken over by real estate developers or for a roadway or other nonrecreational use appears very unlikely, Interior Department officials said last week.

The swap puts an end to prospects that Montgomery County and the District together might convert the right of way into a commuter rail line or highway. The county government is still debating various uses for the portion of track within its boundaries, including mass transit between Metro stops in Chevy Chase and Silver Spring -- or some recreational use, perhaps connected with the District biker-hiker trail.

Agreement to turn the District right-of-way over to the National Park Service is now "99 percent certain," a Park Service official said. Details will be worked out this year or early in 1987 for a swap between CSX and the federal government. CSX would turn over the strip bordering the canal from the Maryland line near the Dalecarlia water works to Georgetown, and would receive an equivalent value of federally owned land. Then the Park Service would prepare a budget for converting the right of way to recreational uses, subject to approval by Congress. The new park would open within a year or two afterward, officials believe.

The probable result will be a mixed-use path, open for hiking and biking along its entire length inside the District. A stretch of track at the Georgetown end might be preserved as a recreational feature. One possibility would be to run handcars or old rail passenger equipment along the track "to give youngsters and oldsters a chance to relive the history of the railroad," a Park Service official said.

The two parties have retained Seymour and Associates of Philadephia to appraise the right of way, which CSX has been quoted as valuing at between $5 million and $10 million. The appraisal is to be submitted by September and negotiations will then get down to details.

The railroad, in exchange for its property, wants equivalent-value lands east of the Mississippi. The Interior Department and the General Services Administration will join in surveying potential swap sites, which could include government-owned warehouses, mineral rights on public lands and even offshore drilling rights. But no federal park land will be swapped, officials said.

In the meantime, the Interstate Commerce Commission is going ahead with its proceeding to determine whether and how the railroad should be allowed to abandon the spur line.

While the ICC is authorized to rule on abandonment of the line, the proceeding is largely a formality, since the line has in effect already been abandoned. The B&O discontinued service more than a year ago, substituting trucks that have taken over delivery of coal to a District power plant under the Whitehurst Freeway in Georgetown.

The spur line used to carry bulk commodities including grain and timber in addition to coal to merchants, lumber yards and factories in Georgetown, but their disappearance in recent years left only the coal traffic and that wasn't enough to keep the spur line going.