Caught between the financial and emotional cross-fire of the first spouse lobby and the last spouse lobby, a House subcommittee is trying to write a pension-splitting compromise on the question of who gets how much of a federal retiree's pension.

A bill before the House Compensation Subcommittee would guarantee partial pension and survivor benefits to an ex-wife or ex-husband of a federal employee if the marriage lasted at least 20 years.

Few issues in the normally bland federal employee legislation front have aroused such controversey. And the implications for all other pension plans - public and private - have brought a host of conflicting opinions to Capitol Hill.

Legislation by Rep. Patricia Schroeder (D-Colo.) would guarantee that a "long-service" spouse (of 20 or more years) would get up to half the pension, or survivor annuity of a former spouse even if the pensioner remarried. Under present law, the first wife or husband is cut out of all pension benefits even though he or she spent of working and nonworking years married to that spouse.

That kind of pension split (which West Germany adopted as federal law in 1976) is reported to as the "earned right of the homemaker." It is to protect persons who, usually because there were children at home, did not work and build up pension plans of their own. When those marriages end in divorce now, courts say award part of the pension to the ex-spouse, but the U.S. government does not permit pensions to be garnished except for alimony or child support.

The bill, which would benefit the first spouse, has run into a wall of opposition from groups ranging from the retirees themselves, second spouses, and civil liberties organizations who argue that states rights would be trampled by the imposition of federal pension-setting rules.

To compromise, the Subcommittee headed by Rep. Gladys Noon Spellman (D-Md.) (who supports the Schroeder bill) may settle on a compromise that, if it doesn't please either group entirely, at least will make both sides less angry.

In effect it would force the government to honor state court orders that provide that the first spouse (regardless of length of marriage) be entitled to a portion of the federal workers' pension, or upon his or her death, part of the survivor annuity.

That approach, a Capitol Hill legislation expert said, would be a reasonably fair and equitable "out." But it isn't a sure thing yet - although it does seem to be the odds-on favorite for a compromise.

Many men favor the pension splitting plan as a fair and equitable way to partly compensate a longtime spouse. Many women - particularly second wives of federal workers - oppose giving any additional benefits to an ex-wife.

There certainly ought to be a way to compensate spouses (Canada is working on a similar law through a province-by-province vote) for time spent in helping a mate build and maintain a career. Others argue that the courts can and do extract enough from one spouse or the other in "compensation" when ruling on divorce settlements. Clearly, it is a touchy and complicated issue.

The complex nature of the pension-splitting plan is one reason both sides are predicting victory, while looking for a compromise that will salvage as much as possible for them. There is no doubt that legislation of this sort is coming. The question the House Subcommittee - which is pioneering it - must decide is what the first, successful test model should be.

One point that should calm many divorced federal workers and their former and current spouses: the legislation will not be retroactive. It will deal only with divorce actions that take place after (and if) the bill is enacted into law.