David A. Stockman, five-star general in the budget wars, stunned Justice Department lawyers last month by writing a letter contradicting their courtroom defense of military draft registration. Friday, Attorney General William French Smith sent his troops into court to repudiate Stockman's position.

But David Landau, attorney for the American Civil Liberties Union, which is challenging Selective Service's requirement that young men give their Social Security numbers when registering, said he feels the damage has been done. Stockman's letter, he says, hurts the federal position and should result in the government's appeal being dropped.

And some Justice Department officials said Stockman's July 31 letter to Sen. Mark O. Hatfield (R-Ore.) threatened to undermine potential criminal cases against 18-year-olds who have refused to register.

In the letter, the director of the Office of Management and Budget attributed the recent fall-off in registration to a lack of publicity, rather than a failure to comply with the law.

Smith "has now personally reviewed this matter and has determined that the previously filed briefs accurately state the government's position and that OMB's letter does not accurately state the government's views," the Justice filing Friday said.

One Justice official said the draft case episode was not the first time Stockman and his counsel, Michael J. Horowitz, have jumped into Justice business without telling anyone and "been just plain wrong." Stockman "after all, went to divinity school, not law school," the official said.

Horowitz said Stockman did not intend to complicate the government's legal position in the draft case. He added that administration officials now are considering whether Social Security numbers really are needed for registration. Thus, it is possible the government's case could be dropped on policy grounds, he said.

Hundreds of thousands of young men have failed to register with the Selective Service since President Carter began the program last summer in response to the Soviet invasion of Afghanistan.

The ACLU challenged the requirement that Social Security numbers be supplied as part of the registration, claiming the Privacy Act precluded it. U.S. District Court Judge Gerhard A. Gesell agreed with the ACLU in a ruling last November.

The government immediately appealed, claiming the numbers were "the essential link" to the military and warning that without them mobilization during a national emergency would be hindered. Oral arguments are set for mid-October.

In his letter to Hatfield, Stockman said the administration's position is that "the Selective Service is not now entitled to require registrants to provide their Social Security numbers." Justice Department lawyers had taken the opposite position in court.

Stockman also said current problems with registration are caused by a lack of publicity. The 1980 registration led to 95 percent compliance, the 1981 registration in January fell off to 87 percent and Stockman projected that only 69 percent of those now eligible were registering.

"We believe this to be primarily a failure to adequately publicize the requirement to register rather than a failure to comply," he wrote Hatfield. "Accordingly, we believe an increase in efforts to ensure that all eligible young men become aware of their obligation to register is preferable to an aggressive compliance program."

Some Justice officials have made it clear they don't relish the thought of a massive campaign of criminal prosecutions of those failing to register, especially when there is no draft now and President Reagan campaigned against it.

About 100 potential cases have been referred to U.S. attorneys around the country, but prosecution guidelines require another notice attempt, officials said.