The rag-tag foot soldiers of organized labor, a sometime bulwark of the old Democratic coalition, were back on the march in this year's midterm elections.

They came away with one of their best Election Day records in recent memory, a new Congress certain to be more sensitive to jobs issues, a beefed-up presence in critical state offices, and a cautious rebirth of confidence in their ability to deliver the goods politically.

The outcome also sets the stage for an emboldened labor operation in the 1984 presidential sweepstakes, which will be interlocked with the Democratic Party and energized by what labor leaders perceive as the wolf at the door: the Reagan administration.

AFL-CIO President Lane Kirkland has launched an ambitious -- and possibly unworkable -- plan aimed at unifying organized labor enough to endorse a Democratic presidential candidate by late 1983, before the presidential primaries. The endorsement would require the approval of unions representing two-thirds of the federation's 15 million members.

This year's elections provided previously turned-off labor troops valuable training and confidence, officials said, as well as giving the labor federation a chance to work the bugs out of its newly retooled political machinery of computer lists, direct mailings, tracking polls and other techniques.

Also important is labor's strengthened political base in the big industrial states that play a major role in the selection of any Democratic presidential candidate, according to Frances Kenin, the federation's liaison with the Democratic National Committee.

"The strength there [with the governors, senators, House members and state legislators] will help tremendously," she said.

"A lot of people who wrote us off are going to have to come back and pay some attention to us now," said Murray Seeger, a spokesman for the AFL-CIO. "We showed what we can do. We think we can do better."

Potential Democratic presidential contenders are already scrambling to speak at union gatherings in quest of the endorsement, which would bring with it labor's grass-roots organization and money in the 1984 campaign. Just the possibility of such an unprecedented endorsement is expected to have a ripple effect, making the presidential campaigning next year even more intense than in the past.

Sen. Edward M. Kennedy (D-Mass.) and former vice president Walter F. Mondale are currently the favored contestants for the labor prize, but, said Seeger, "That list is still wide open."

In sheer numbers, the fortunes of organized labor showed dramatic improvement in the results of gubernatorial, senatorial and House races compared with the past two elections.

In contrast with two years ago when the labor swing vote was credited with -- or blamed for -- helping elect President Reagan, members of union households last Tuesday voted Democratic by more than 2 to 1, according to ABC exit polls. This signaled a return to a more traditional pattern compared with the virtually even split of the blue-collar vote between Reagan and President Carter in 1980.

Members of union households also voted disproportionately to their numbers, casting 41 percent of the Democratic votes nationwide although they account for just 23 to 25 percent of all households.

"There was clearly a return to the fold, largely attributable to the labor leadership showing the way and committing resources to the nuts-and-bolts activity they do so well," said Robert Neuman, a DNC spokesman.

A slight increase in voter turnout nationwide, reversing a 22-year trend, was concentrated primarily in regions hit hardest by unemployment and other economic troubles, according to Curtis B. Gans, director of the Committee for the Study of the American Electorate. The only exception to that pattern was Pennsylvania, where he said the turnout was down.

In governor's races, the victories of 24 of the 33 candidates endorsed by the Committee on Political Education (COPE), the AFL-CIO's political arm, was labor's best showing in recent years except for the Watergate year of 1974. In the 33 Senate races, COPE endorsed 31 candidates and 20 won, a 64.5 percent success rate, compared with 34 percent in 1980 and 40 percent in 1978.

In House races, 237 of the 376 COPE-endorsed candidates, or 63 percent, won, about the same as in recent elections.

Labor's intense efforts to defeat Sen. Orrin G. Hatch (R-Utah) and Rep. Robert H. Michel (R-Ill.) failed, though in the latter case not by much. Another major disappointment included the defeat of Mississippi state Rep. Robert Clark (D), a black candidate who was "virtually sponsored" by the state's labor federation in his House race.

Other disappointments were the losses of Rep. Leo C. Zeferetti (D) in New York, Rep. Bob Shamansky (D) in Ohio and of Gov. Hugh J. Gallen in New Hampshire. In some races, labor split and its influence was to some extent neutralized.

But in many elections, labor was a potent segment of the old Democratic coalition, which includes Roman Catholics, Jews, blacks and the poor.

In any case, the newly refined approach of labor leaders is to target their resources, to matter in the margins.

Democratic officials and candidates credit the labor grass-roots organization specifically with a pivotal role in several Democratic victories, mostly in strong union states of the industrial Midwest and Northeast.

In the steel mill country near Pittsburgh, they helped Democrat Joseph P. Kolter knock off "turncoat" Rep. Eugene V. Atkinson, who supported Reaganomics and recently switched to the Republican Party.

Union troops helped upset Republican Rep. Ed Weber in Toledo and install a liberal and former Carter White House aide, Marcy Kaptur.

In the New York governor's race, which was touted as a classic referendum on Reaganomics, labor officials claimed a measure of credit for their role in the general election victory of liberal Democrat Mario Cuomo and his primary victory over Mayor Edward Koch.

Along with environmentalists and civil rights groups in San Francisco, they helped one of their staunchest allies, Rep. Phillip Burton, another liberal Democrat, save his seat in a tough race.

In California, the politically powerful National Education Association, a teachers' union independent of the AFL-CIO, took partial credit for one of the few successful write-in campaigns in recent times. They helped elect Ron Packard, a moderate Republican who supported education funding, over Republican Party candidate Johnny Crean.

And in Texas, labor gets a share of the credit for tilting the Houston area Democratic for the first time in 20 years.

Labor, along with Hispanic groups, also contributed to the defeat of New Mexico's Republican Sen. Harrison H. Schmitt. And labor groups claim come credit for making Harriett Woods, who came within a hair of upsetting Missouri Sen. John C. Danforth, a viable candidate.