It wasn't the picture of decorum, but there was Gaylord Nelson, a 64-year-old U.S. senator, darting through the mucky underbrush along the railbed in the dark of dawn.

Nelson, running harder for reelection than ever, got to the commuter train just before it left for Milwaukee the other mourning.

The idea was to show his support for mass transit. He shook hands with impressed commuters and settled back in his seat, on his way through another of his dawn-to-midnight campaign forays around the state.

Two stops down the line, the picture of the fight for Nelson's Senate seat began to come a little clearer. His boyish Republican opponent, Robert W. (Bob) Kasten Jr., abandoning other planned activity, climbed aboard the train and crashed the party.

Kasten, 38, handed out leaflets and buttons and plumped for votes. He stepped off the train at Milwaukee into the glare of television that gave him needed exposure reporters wrote up the commuter train encounter.

Perhaps a month ago, Kasten would not have had to resort to piggybacking his campaign on Gaylord Nelson's shoulders. Kasten was up and Nelson was running a desultory race for a fourth term.

"Until about three weeks ago, Gaylord Nelson didn't know he had a race," Kasten said. "But he knows it now. I'm hitting hard at 'the Nelson Gap,' -- the difference between what he says and what he does."

Things seem to have turned around since then and an energized Nelson now appears to be in command and moving.

Nelson is too nice a fellow to say such things publicly, but his campaign aides mince no words in portraying the senator's feelings. "Gaylord is busting his ass. He takes it as a personal affront and as an affront to the people of Wisconsin that Kasten is taken seriously," said one.

The senator's way of putting it is that "out job is to get the excitement going among our voters and that is happening. You can see a growing effort by labor, by Democrats. It's been on the upswing for me and President Carter the last couple of weeks."

Republican rank-and-filers and some of their leaders now are conceding that Carter has a good shot at winning Wisconsin's 11 electoral votes, a prospect regarded as ludicrous just a few weeks ago.

Kasten has been counting heavily on a Reagan sweep here to help him over the hump against Nelson. But if Reagan support is showing fissures, it is minor compared to the problems Kasten faces.

For one thing, a point Kasten readily concedes, he is running against a man who is as close to living legend as is likely to be found in American politics. He lives on his salary, he is free of taint and he thinks he was sent to Washington to lead, rather than follow.

Nelson, a lawyer and son of a country doctor, worked in Works Progress Administration programs for 30 cents an hour, was a labor organizer, a founder of the modern state Democratic Party, a state senator and two-term governor before going to Washington.

"There is a problem in hitting at Nelson personally," Kasten said. "People see him as a grandfather. They feel he is basically a good person. That makes it difficult for me."

For another thing, as the economy has soured in other states, agricultural-industrial Wisconsin has stayed relatively free from hurt (unemployment, at 7 percent, is close to the national average) and Kasten has found it difficult to capitalize on the economy as an issue.

Perhaps more importantly, Kasten -- unlike his well-heeled GOP counterparts in other areas -- is suffering from acute economy problems of his own. Still attempting to raise money, he said he won't have radio-TV ads during part of the time between now and Nov. 4.

Kasten's hopes were buoyed a month ago when a Republican poll showed him with a two-point edge over Nelson. That made Nelson staffers catatonic, even though the senator's own polls have never shown him behind.

And that apparently was enough to shake the lead out of Nelson, who doesn't like campaigning but does it to a fare-thee-well once he gets started. His advertising blisters Kasten for his ambition (he ran for governor and lost in 1978 while still in the House), for absenteeism (he missed 400 or so roll calls during that year) and for his negative votes that affected the poor, the sick and the small in Wisconsin.

The best Kasten can do in response to that is argue, as he does at one rally after another, that Nelson is a tired liberal whose votes contradict themselves, a man who is soft on defense and unable to economize.

"The negative carries him a long way," Nelson said. "And it works better when times are hard. But that is traditional in politics. It's not news for me to say I have worked on the environment, or started Earth Day or supported farm, labor and social programs vital to Wisconsin. So I'm talking about the future or comparing my record to his on the issues. I just don't think the country has turned as conservative as some people think. They want an end to waste and red tape, not an end to federal programs."

In a typical day last week, Nelson rode the commuter train, addressed mayors and praised Comprehensive Employment and Training Act job-training programs, attended an NAACP reception (he is a darling of the state's blacks), went to a Democratic reception at the Norwegian town of Stoughton and ended the night with a rousing speech at the University of Wisconsin in Madison.

There, in a joint appearance with Rep. Robert W. Kastenmeier Jr., the Madison-Dane County Democrat who is in a tight race, Nelson told the students he would push for ratification of the strategic arms limitation treaty (SALT II) if returned to the Senate.

"Anyone who aspires to the high political office and does not understand the awesome consequences of an accelerated nuclear arms race simply is not qualified to hold office," he said, lumping Kasten and Ronald Reagan together.

Kastenmeier, for his part in a tough campaign with a wealthy yo-yo manufacturer, James A. Wright of Baraboo, asked Nelson for a favor the other evening. Nelson's ads attacking Kasten's absenteeism were confusing folks in the 3rd District into thinking it was their man, and the senator ordered the ads removed from the air there.

Which tells a great deal about Republican Bob Kasten's name recognition in a year when he needs every vote he can get.