IT HAS BEEN clear for some time that legislation is needed to reform the immigration laws. This year it appeared that Congress would finally come to terms with this emotional and controversial subject. Interest groups from labor unions and the ACLU to agricultural conglomerates and zero population growth people have a stake in how the law is written. Dozens of ethnic groups and tens of thousands of families have ideas on who should be given preference. Even foreign governments have something to say about how we handle refugees and whether their brightest young people who come here to study should eventually return home. It is not a subject on which compromise is easy, but compromise has been accomplished.

The Simpson-Mazzoli bill, which was passed by the Senate in July, appeared to contain something for everyone. Employer sanctions would be imposed on those who hired illegal aliens, but such aliens already in the country -- we can only guess at their number, but there are probably 9 to l0 million -- would be given amnesty. For the first time, a numerical limit would be placed on legal immigrants, with preference given to family members and skilled workers. But this number would not include refugees, who could be admitted in any number in the event of an international crisis, for example, as long as the president and Congress agreed.

When the bill was considered by the Senate last month, not everyone was happy with every aspect of the proposal, but a large majority believed that the compromises that had been made were fair. Amendments offered by Sen. Huddleston to restrict the total number of immigrants and by Sen. Kennedy to increase the total were both defeated. Last week, however, the House Judiciary Committee marked up the bill and adopted a number of the liberal amendments that the Senate had rejected. This is where the risk comes in. There is now a great danger that the compromise will begin to unravel -- a scenario often witnessed during the closing days of a congressional session. Opponents may try to keep the bill from the floor. The compromises on amnesty and refugees, which conservatives never liked anyway, may come apart. Years of work and careful balancing may be lost in the rush to adjourn.

As the birthrate falls in this country, immigration accounts for a larger share of total population growth every year. These are big numbers, and they affect our economy as well as the social fabric of the country. If the bill fails, and legislators have to go back to the drawing board, valuable time and momentum will be lost. This should not be allowed to happen. It is the responsibility of the House leadership to count votes carefully and to be flexible in forging and preserving compromise so that this important legislation can be enacted this year.