U.S. District Court Judge Charles R. Richey yesterday ordered Secretary of Agriculture John R. Block to reallocate as much as $12 million in food aid allegedly being withheld from needy pregnant women and their children.

Richey acted in response to a suit filed earlier this week by the Food Research and Action Center and three House members.

The suit charged that nearly 50,000 participants had been dropped from Women, Infants and Children (WIC) supplementary food programs in Georgia and New York because of a lack of funds, although other states had not spent all of their WIC funds and Congress had mandated that the excess be reallocated.

Richey's order gives Block five days to determine exactly how much excess money is available and seven more days to reallocate it. Last year, according to the suit, 250,000 participants were dropped from the program because $50 million in excess funds was not reallocated.

Administration officials could not be reached for comment yesterday.

About 2.2 million women and children are served by the $1 billion annual WIC program. Reagan administration efforts to cut its funding have been defeated in Congress.

Nancy Amidei, director of the Food Research and Action Center, said yesterday that she was pleased with the court victory, but added, "This suit shouldn't have had to have been brought. If John Block had obeyed the directive of Congress, there wouldn't have had to be anyone cut off."