Pentagon leaders are threatening to go to court, if necessary, to prevent local public school systems from charging military families tuition in retaliation for the loss of federal funds used to educate their children.

Several Virginia school districts, including Fairfax County, York County and Norfolk, have announced plans to recoup the millions of dollars they will lose if so-called impact aid is eliminated as part of the Reagan administration's budget cuts.

"I am determined that no soldier, sailor, airman or marine will be forced to pay tuition for the public-school education of his or her dependents," Defense Secretary Caspar Weinberger said last week in a memo to his service secretaries and the joint chiefs of staff.

A Pentagon spokesman said yesterday that military leaders were looking at "several ways" to block school systems from charging tuition, including filing lawsuits questioning the constitutionality of charging only military families for schooling that is provided free to all other school-aged children.

The Virginia General Assembly, anticipating a loss in federal impact aid, this year authorized localties to charge military families tuition, and Fairfax County has warned the Army it will close three elementary schools on Fort Belvoir if it loses more than $4.4 million in impact aid.

"The complicating factor here is that Congress has not yet made the cuts and indeed may not include the school year begins. the legal situation is awkward," the Pentagon spokesman said.

Impact aid provides school districts with $850 million a year in federal funds to compensate for the cost of educting the children of federal workers whose parents work on -- and often live on -- federal property, which is exempt from local real estate taxes. Such taxes are the major funding source for most school systems.

The program is especially important to Washington-area schools, which are faced with the loss of about $43 million if the program is abolished.

The Reagan administration originally included plans to cut the impact aid program by only 45 percent, but Democrats on the House Education and Labor Committee voted earlier this month to abolish the program. In school districts such as York County in southern Virginia, which relies on federal dollars for one-quarter of its operating budget, school officials say that losing the funds would be catastrophic.

York County officials last week sent each of 2,500 military families a letter informing them that they would be assessed an undetermined amount of tuition next year, and that the sum would be payable in 10 installments, beginning Aug. 1.

School officials also have removed military dependents from the school rolls and are requiring each military family to fill out registration cards by June 20. The county, northwest of Newport News, is surrounded by Navy, Air Force and Army bases.

Pentagon officials said yesterday that they were aware of York Country's action and had forwarded copies of the county's letters to the Justice Department. "Our concern now is to reassure military families that no matter what happens, their chilren will be able to attend school in the fall," said one Pentagon spokesman.