After years of failed congressional attempts to pass higher salaries for federal employees in the defense, energy, space and medical fields, a House committee yesterday approved legislation to increase pay for all federal workers and boost salaries dramatically in localities where pay has fallen behind the private sector.

The House Post Office and Civil Service Committee, on a 19 to 4 vote, approved a bill that would allow workers for the first time to be paid differing rates in localities across the country, depending upon the market.

Committee Chairman William D. Ford (D-Mich.) called the vote "something history-making . . . we've not made a serious attempt to modernize the federal pay structure in this century. We've been operating under a pay system designed for an agricultural economy, for a government that did not regulate much of anything and that didn't engage in much research."

Ford called the bill a "far from perfect instrument," but said negotiations are underway to win the support of President Bush as well as a majority of the Congress.

Two major issues divide the bill's supporters from the administration -- money and presidential prerogative to determine a pay figure that is different from that set forth in the law, sources said. The cost of the bill, sponsored by Rep. Gary L. Ackermann (D-N.Y.), is estimated to be $9.5 billion over five years. The administration has agreed to a plan costing $3.7 billion.

The Ackerman legislation calls for giving federal workers a raise each year equal to the "Employment Cost Index," the measure of private industry wages and salaries for white-collar workers, excluding sales workers. The principal difference between the ECI and most other government compensation measures is that they measure wages only, while the ECI includes fringe benefits and other costs, such as worker's compensation.

In addition, many workers would be eligible to receive "comparability payments" based on the pay disparities between the federal government and other employers, community by community.

Nationwide, federal pay surveys show that federal workers are an average of 28.6 percent behind the private sector, but more detailed investigations commissioned by the Office of Personnel Management show that the uniform General Schedule that the government uses to set pay scales results in a few people being paid more than the market rate and many others paid far less.

The Ackerman bill would require the government to survey local salaries and to pay workers at least 10 percent of the "gap" between private and public salaries each year until the gap was closed.

The first pay raise under the Ackerman legislation would occur on Oct. 1, 1992. In the meantime, the president would be able to pay 8 percent increases to employees in New York, San Francisco and Los Angeles "as well as any other geographic area."

Ackerman also would give the government the authority to pay up to 400 "critical" position employees as much as a Cabinet secretary, which in 1991 is expected to be $138,928.

In addition, the bill includes authority to pay special rates in areas where it is difficult to recruit people to perform certain jobs, to offer recruitment and relocation bonuses, retention allowances, to pay travel and transportation expenses for job candidates and newly hired employees, to give advances in pay and to increase uniform allowances.

"We are very pleased with most provisions of the bill," said OPM Director Constance Newman. "We are working very closely with the committee. The chances are very good that we will have a pay bill this year."