For days, Terry Flaherty had paced the aisles of the Blue Ridge, a popular Martinsburg-to-Washington commuter train threatened with extinction, asking his fellow passengers for ideas to publicize their plight.

Then just over a week ago, one of them had an idea. "Why not ask Arlo Guthrie to play for a rally?" suggested one woman, who offered to contact the singer-composer.

Yesterday, the day of a congressional hearing on a Transportation Department plan to cut Amtrak service 43 percent nationwide, Guthrie and his seven-piece band, The Shenandoah, responded to the suggestion. On behalf of the Blue Ridge and other threatened trains, Guthrie played a free concert in the concourse of Union Station here at a "Save the Trains" rally.

"Friends of the Railroad," an organization of rail passengers of which Flaherty is president, bought tickets for Guthrie and his band to make the trip from Western Massachusetts. They rode the Montrealer, another train that the legislation would eliminate, down and back yesterday.

As hundreds of balloon-waving train passengers clapped their hands and sang along, Guthrie played his recorded tribute to a train, "The City of New Orleans," improvised version of "I've Been Working on the Railroad," and other traditional train songs.

The 4 p.m. rally was the climax of a day in which railroad passengers bombarded Congress with demands that the proposed reduction in train service be derailed.

Transportation Secetary Brock Adams has argued that the service cutback is essential to reduce the mounting Amtrak deficit and keep his budget in line. The cutbacks would fall most heavily on such long-distance routes as Washington-Montreal, New York-New Orleans, and Chicago-Texas.

Amtrak's Commuter Service-trains like the Blue Ridge-is also targeted for cutbacks.

Adams, whose plan would go into effect Oct. 1 in the absence of legislation preventing it, has said that it is up to the states to provide the subsidies needed to keep commuter trains in operation-or it is up to the passengers to pay high enough fares to meet the operating costs.

Even when the Blue Ridge is completely ful, it still loses money, transportation officials say.

Flaherty is director of the Office of Senate Parking. he moved to Harpers Ferry six years ago and quickly discovered that, while it is convenient and pleasant to ride the Blue Ridge train, commuters like him must endure "the recurring suspense" of threatened cancellation.

So yesterday, he and other regular commuters were out in force for a congressional hearing hoping to stave off a threatened shutdown of the Blue Ridge and the Shenandoah.

Three members of Maryland's congressional delegation, Republican Sen. Charles McC. Mathias and Democratic Reps. Beverly Bryon and Barbara Mikulski, joined Flaherty on the early morning commuter train yesterday.

Mathias borded the train at Rockville, where he chatted with Bob Gowers and other regular passengers in the rain outside of the red brick depot.

What with the addition of the congressional commuters, the anticipation of the hearing and the concert, yesterday's trip to Union Station was especially festive. Flaherty paraded up and down the aisles of the nine cars behind a bedsheet banner, urging passengers to attend the hearing before the House subcommittee on Transportation and Commerce.

Barbara Protas, a secretary at the World Bank who also lives in Harpers Ferry, pasted "save the trains" stickers on passengers while clutching her Guthrie album, "Alice's Restaurant." which she hoped to get autographed at the afternoon rally.

At the hearing later in the day, Mikulski asked Transportation Secretary Adams to "defend yourself" about the proposed cutbacks in service.

"I'm not recommending that the Blue Ridge stop," answered Adams, saying that he merely wants the states to subsidize its operation, as Congress ordered last year.

Rep. James J. Florio (D-N.J.), the subcommittee chairman, read a statement by Rep. Harley O. Staggers (D-W.V.), chairman of the full Committee on Interstate and Foreign Commerce.

Staggers denounced the proposed cutbacks as "sheer folly." Discontinuing the Blue Ridge, he added, would "burden the highways" and add more congestion, pollution and parking problems in Washington.

Bryon was one of many congressional witnesses who said retaining the trains would offset the effects of escalating gasoline prices.

While Adams insisted that "I am for passenger trains," the cabinet secretary said the current Amtrack system is "an energy waster."

The proposed streamlining would save $1.4 billion during the next five years, Adams said, while continuing service for 91 percent of current riders.

Adams' testimony evoked mumbles from the commuters who had jammed the hearing room. Some of them were aware that the Blue Ridge and Shanandoah were the two fastest growing trains in the Amtrak system last year.

As a result of its growing popularity (patronage on the Blue Ridge was up 19.4 percent last year for a total of 256,000 riders) the operating loss was cut from $464,000 $306,000 last year. It is that amount that DOT wants Maryland and West Virginia to make up. CAPTION:

Picture 1, REP. BARBARA MIKULSKI . . . speaks out at hearing; Picture 2, SEN. JENNINGS RANDOLPH . . . happy on the train; Picture 3, Amtrak's "The Blue Ridge" approaches picturesque Harpers Ferry, W. Va., station in this 1975 photo. The commuter run would be abolished under a DOT cutback proposal. Amtrak photo; Picture 4, SECRETARY BROCK ADAMS . . . calls cutbacks essential; Picture 5, ARLO GUTHRIE . . . sings to save trains.