In a rare instance of philosophical alignment, the Reagan administration, education-advocacy groups and members of Congress are all saying the same thing -- the government's education program for disadvantaged children should be reshaped, with funding targeted more to the neediest children.

The harmony is even sweeter, given the weight and stature of the program known as Chapter 1, the largest federal effort for elementary and secondary education. This year alone, the program spent $3.9 billion on nearly 5 million children in about 14,000 school districts.

But when it comes to tinkering with popular programs, especially those that pass out money, nothing is easy, even when everybody agrees.

This spring, when Congress undertook its first substantive review of the program in nearly a decade, the Department of Education pushed for a spending formula that would shift money away from richer school districts to poorer districts. The argument: Many districts with only a small proportion of disadvantaged students receive Chapter 1 funds.

Like any proposal that takes money away from congressional districts, the department's was not universally popular on Capitol Hill. The House voted instead to concentrate new funds on poorer schools but leave the current funding formula alone.

The education-advocacy groups lent their support to the House measure but argued that, because less than half the eligible students are being served, overall funding should be boosted.

But the biggest fight over funding may lie ahead, when the Senate takes up the program shortly after reconvening next month.

"Everybody feels there are concentrations of poor children that need more funds," said Diane L. August, director of the education division for the Children's Defense Fund. But the issue of how to target the money, she added, "is very politically charged."

Chapter 1, a program that dates from the flood of Great Society legislation two decades ago, is the centerpiece of the government's effort in elementary and secondary education. Funds are distributed to local school districts who direct them to schools with high concentrations of poor students, with the intention that the money eventually be used to help students deemed "educationally disadvantaged."

Congressionally mandated studies have found it generally effective, both in reaching disadvantaged children and in improving academic achievement.

Moreover, it is one of the few domestic programs the Reagan administration has recommended for level funding, and this year Education Secretary William J. Bennett called for a $2 billion increase.

While the scope of the program -- 90 percent of the nation's school districts receive funding -- has made it politically popular, the wide distribution also has prompted criticism.

"Many students benefiting from Chapter 1 funds are neither educationally nor economically disadvantaged," the Education Department reported in a budget document this year. The department said that in the 1981-82 school year, almost 40 percent of the districts receiving Chapter 1 funds had fewer than 10 percent of their children in poverty.

But charges that the program is serving less worthy students while needier children go without help have been disputed, and the House subcommittee on elementary, secondary and vocational education issued a staff report this spring declaring the criticism "unfounded."

"If many needy children are unserved, it is because there are insufficient resources in Chapter 1 to serve more," the report said.

At the same time, House members voted overwhelmingly to increase funding for the program by $459 million and concentrate $400 million of the additional funds on the poorest districts.

The support for more targeting stems from a recognition that money is less effective when spread thinly across the country and from research showing that poor children surrounded by other poor children are less likely to succeed in school than poor children in affluent districts.

According to the existing formula, said Michael Casserly, legislative director for the Council of the Great City Schools, "A poor kid in Montgomery County would attract as much per child as a kid would in Baltimore City. That makes sense in one way, because you want it to go to the poor kids, but also, in concentrated areas of poverty, there's a geometric increase in need."

While staff members say senators are inclined to better target the money, the dynamics of the debate will differ from the House, where tensions ran between rural southern and big-city districts. In the Senate, a struggle between large and small states is emerging.

The argument -- supported by Sen. Claiborne Pell (D-R.I.), chairman of the Labor and Human Resources subcommittee on education, arts and humanities, and ranking Republican Sen. Robert T. Stafford (Vt.) -- that small states have administrative costs similar to larger states, but get shortchanged by the distribution formula.

As a result, Pell attached a provision helping small states to the massive trade bill recently passed by the Senate, where it raised significant opposition.

Pell agreed to drop the provision from the trade bill, but vowed to revisit the controversial issue when his subcommittee takes up Chapter 1 funding.

On other changes to the Chapter 1 program, the Senate appears inclined to follow the lead of the House, which voted to expand the program to high schools and preschools, increase parental involvement and provide funds to help school districts serve private school students.

Senate aides say the bill is scheduled to come up before Pell's subcommittee in late September and before the full Labor and Human Resources Committee by early October.