President Carter's plan to create a separate department of education passed the House yesterday after weeks of conflict, but only by a grudging four-vote margin, 210 to 206.

Carter and the National Education Association, the Bill's biggest Booster in the education community, expressed delight at the outcome.

Carter, calling enactment "an important administration priority," said it will "streamline administration of more than 150 education programs, saving tax dollars and cutting red tape."

But the strongest opponent, the American Federation of Teachers, and conservatives like Rep. John N. Erlenborn (R-Ill.) said they were encouraged by the near-defeat of the bill. They vowed an all-out attempt to kill the conference report after the House bill goes back to the Senate to compromise differing versions.

"The size of the vote hardly indicates an overwhelming sentiment in the House," said the AFT's chief lobbyist, Greg Humphrey.

The tiny House margin, plus controversial House amendments on school prayer, busing, affirmative action and abortion, will be impediments when the bill goes to conference and then back to each chamber for approval. Some amendments are so controversial that, unless they are dropped in conference, some of the bill's supporters may turn against it.

"With a four-vote margin and all those amendments we've still got a crack at it," said Erlenborn.

"If the conferees drop the amendments, then more conservatives will vote against it back here in the House," he contended. "If they don't drop them, some of the liberal supporters will switch and vote against it."

The bill, Carter's major reorganization proposal this year, creates a Cabinet-level department with a budget of about $14.1 billion a year and about 18,000 employes.

It would take over from the Department of Health, Education and Welfare all major elementary, secondary and college-aid programs, student aid and vocational rehabilitation, plus several smaller units and the Defense Department's overseas schools for children of service personnel. The Senate Version passed April 30, 72 to 21.

One anti-abortion amendment, added yesterday by John M. Ashbrook (R-Ohio), would forbid the new education department from providing abortions for teachers or the wives of teachers covered by medical plans for Army children's schools abroad, unless the mother's life is in danger.

Another, also by Ashbrook, would bar any universities that provide abortions as part of student medical services from use of buildings owned and controlled by the new department.

An earlier amendment declares that one of the purposes of the department is to "permit" voluntary daily prayer in public elementary and secondary schools, despite Supreme Court rulings limiting school prayer.

Still another would bar busing to achieve desegregation, and a proposal by Robert S. Walker (R-Pa.) would bar the new department from imposing any "ratio, quota or other numerical requirement" relating to race, sex, creed or national origin.

Conservatives who put these amendments into the bill clapped delightedly yesterday when Shirley Chisholm (D-N.Y). denounced their provisions as "anti-affirmative action" and directed against minorities. They didn't resent the denunciation, because her conclusion was that the bill should be defeated - precisely the outcome that many amenders had in mind.

For entirely different reasons - fear that creation of the department would weaken the entrenched lobbying positions of the civil rights coalition, weaken attempts to coordinate anti-poverty programs, and overemphasize public education at the expense of religious day schools - the AFL-CIO, many civil rights groups, and the Catholic Conference also opposed it. The American Federation of Teachers was motivated partly by fear that its archrival, the NEA, would dominate the department.

Chisholm, a Black Caucus member, said the administration, in an attempt to obtain votes from some House members, had been hinting that it would "make a black person the head of the department" - an apparent reference to California Education Commissioner Wilson Riles. Jerry Appodaca, former New Mexico governor, and Alan Campbell, head of the Office of Personnel Management, are said to be other possibilities.

Maryland's congressional delegation voted no yesterday except Gladys Noon Spellman (D), who was not recorded. Virginia Reps. Joseph L. Fisher (D), Herbert E. Harris (D), Paul S. Trible (R), William C. Wampler (R) and Dan Daniel (D) voted yes; other Virginians voted no.