Last spring and summer, when President Reagan's budget and tax plans were coming up for their first House tests, freshmen Reps. Roy Dyson and Bob McEwen had no trouble casting their votes. Though Dyson is a Democrat from Maryland's Eastern Shore and McEwen a Republican from southern Ohio, the sentiment in their districts was clearly the same: to give Reagan's program a chance.

But that was a year ago. Now unemployment has soared--to 17 percent in McEwen's district and almost 14 percent in Dyson's. And the two young legislators--Dyson is 33 and McEwen is 32--are squirming as they wonder whether their thin margins of victory in 1980 will hold up in this November's voting.

They have solved the problem temporarily by voting this week for both the liberal and conservative alternatives to the Reagan budget, however contradictory that may seem. For them, as for others, the budget votes in the House are being cast with one eye on the substantive issues and one eye on the election. "It's called positioning," said one House Democratic leadership aide, "and if anybody tells you that's not what he's doing, you can call him a liar."

At the leadership levels of the House, that "positioning" has come in the behind-the-scenes negotiations over the order of consideration of alternate budgets and the acceptance or rejection of specific amendments on education, welfare, defense spending, pensions and taxes.

Yesterday, the positioning game had reached the point where many members thought they detected a suspicious nonchalance among leading Democrats about the possibility that the Reagan-backed budget alternative might win again this year in the nominally Democratic-controlled House.

Feeding such speculation were comments from such members as Tony Coelho of California, the chairman of the Democratic Congressional Campaign Committee. "No party likes to be perceived as being unable to win," he said yesterday, "but the other side is that if the president continues to win, he can't make excuses that the economy is somebody else's fault."

But those broad strategies are not the problem of freshmen like Dyson and McEwen. Their concern is survival, and that concern prompted both of them to embrace on successive days this week what appeared to be contradictory alternatives to the Reagan budget.

On Monday, both voted for the substitute budget sponsored by Rep. David R. Obey (D-Wis.), the former chairman of the liberal House Democratic Study Group. The Obey budget would have protected most domestic programs from cuts, while restraining defense and raising taxes $233 billion over the next three years, ostensibly bringing the budget into near balance by 1985.

Then yesterday, both voted for the substitute budget sponsored by Rep. John H. Rousselot (R-Calif.), a former member of the John Birch Society and leader of conservatives in the House. The Rousselot budget would have raised taxes only $19 billion, but ostensibly would have achieved a balanced budget next year by cutting non-defense spending $113 billion in one year and $452 billion in three.

Neither proposal passed nor was particularly intended to. Rousselot's was a vehicle for conservatives frustrated by the inevitability of big deficits in whatever the final version of this year's budget turns out to be. Obey's was a vehicle for liberals frustrated by the fact that there seems no way out of trimming welfare spending in a recession.

Dyson and McEwen have both liberals and conservatives to appease in their shaky districts. From their point of view, it was sensible and not illogical to vote for both alternatives.

"The Obey budget was the only one that provided for an extra 13 weeks of unemployment benefits," said McEwen, adding that the layoffs in the glass, steel, chemical and auto-parts plants in his district--and the rest of Ohio--have made that kind of federal help urgent.

On the other hand, he said, the Rousselot promise of an immediate balanced budget would be welcome to many in his district, who "are fearful that if we end up with a $100 billion deficit next year, we're just not going to have an economic recovery."

Dyson makes a similar argument. "This whole thing is more a matter of perception than substance," he says. "It was obvious that neither of these alternatives was going to pass, but it did show us two different paths to a balanced budget, which is what people want."

Dyson said neither he nor his constituents care whether the final budget bears the label of Michel-Latta (the one Reagan has endorsed), Jones (the House Democratic budget version) or Aspin-Pritchard (the so-called moderate alternative). "People call in and say, 'Support the bipartisan budget,' and I say, 'Which is that?' and they gulp and say, 'Well, you know which one it is.' "

"The key thing," he said, "is that Congress has to pass a budget. I'm not that concerned about the details."

Nor is McEwen. Asked if it was "consistent" to vote for both the Obey and the Rousselot substitutes, he thought for a moment and said: "That's a legitimate question."