The Justice Department said yesterday that it is going to investigate an Air Force missile officer to see if federal criminal statutes, including those involving espionage, were violated when he allegedly made three unauthorized visits to the Soviet Embassy here.

The department's statement, which government sources said came after a phone call yesterday from Defense Secretary Caspar W. Weinberger to Attorney General William French Smith, reversed statements over the weekend by a Justice Department spokesman and added another dose of confusion to the mysterious case of Air Force 2nd Lt. Christopher M. Cooke.

Cooke, 25, is deputy commander of a launch crew for a nuclear-tipped Titan missile. He is under confinement at McConnell Air Force Base near Wichita, Kan., charged with three counts of violating Air Force regulations that require reporting of any contacts with representatives of communist countries.

While conviction on such charges could result in as much as two years in prison for each of three embassy visits Cooke allegedly made between last December and May, the case could take on far more serious charges and penalties if brought under federal criminal statutes.

Military sources who are familiar with the case and who asked not to be identified, claimed Cooke passed information to Soviet diplomats that was sufficiently sensitive to cause the Air Force to change codes that would be used in sending launch messages from the president to Titan command centers and also to do some retargeting of the missiles themselves.

These sources said there is no indication that the Soviets sought out Cooke. They said on his first and second alleged visits it appears that Cooke made no headway with Soviets he saw in the embassy. On the alleged third visit, they said, he passed on material he had copied or possible photographed, perhaps in order to impress the Soviets with his authenticity.

These sources also revealed that Cooke was detected going into the embassy on his first alleged visit by a technique sensitive enough that the Air Force may eventually drop one of the three counts against Cooke so as not to have to reveal it in legal proceedings. There reportedly are other witnesses to subsequent alleged visits.

These sources said the Air Force still cannot explain Cooke's actions exactly, although one senior officer said he thought there was in Cooke "a little bit of Walter Mitty," the fictional character with a secret fantasy life of great heroics.

Military sources said the Strategic Air Command, which covers all Air Force nuclear missiles and bombers, and commanders at McConnell originally were so worried about how much Cooke may have told the Soviets that they promised him some form of immunity if he cooperated fully with the Air Force investigation.

One officer called the promise a "damage-limiting operation," meaning the Air Force was more interested in finding out what Cooke might have revealed that could endanger the Tital missile force than it was in punishing him.

Now, however, it is being claimed that Cooke did not fully cooperate, resulting at least in lodging of charges involving failure to report the alleged contacts.

Those charges were announced Friday night in an Air Force statement that also claimed "the case has been referred to the Department of Justice for possible prosecution of other offenses." The Air Force claims it referred the case to the Justice Department Friday afternoon.

But department spokesman John K. Russell told reporters Sunday that while Justice had been "advised" about the case, "it is a military matter. We are not investigating it. We're not going to prosecute it, for sure."

Russell's published remarks caught Weinberger's eye, and he called Smith to ask the Justice Department to take another look, sources said.

Russell insisted yesterday that the Air Force had not made a formal referral of the case to Justice until yesterday afternoon, and other law enforcement officials claimed privately that the unilateral Air Force action on immunity for Cooke complicated the situation.

While the Air Force made changes in Titan codes after the Cooke episode, military officers said those codes change periodically anyway.

Officers at SAC headquarters also said yesterday that missile crews do not know and cannot find out their missiles' specific targets. Some retargeting is done periodically, the officers said, as missiles are overhauled or even as seasons change since, for instance, a shipyard frozen in winter does not make a good target.

Nevertheless, military officers claimed additional retargeting has been done now because of concern that the Soviets may have learned about Titan maintenance patterns with respect to when certain missiles are under repair and the pattern of target shifting.

Such information conceivably could be of use to Moscow in determining which of the 52 operative Titans should be hit first in any attack.

The Titan warhead carries the explosive power of 9 million tons of TNT, dwarfing the punch carried by the 1,000 other U.S. land-based Minuteman missiles. Titan is known to be aimed at certain targets that must be hit quickly, with huge force and heavy damage. In general, these targets are believed to be underground command posts and large industrial centers.

Air Force sources said that in order to keep missile officers apprised of the importance of their jobs, they are given a general awareness of the kinds of targets at which their missiles are aimed.

But one reason they allegedly are not told their specific target is to avoid emotional problems that might arise if an officer knows he might kill the population of a certain city.