Spurred by a threat that Hispanics might boycott the census, the Justice Department yesterday announced it would halt routine sweeps of illegal aliens for the next three months.

The decision came after two days of negotiations with Hispanic leaders. Mexican-Americans and other Latinos had charged that the arrest of 800 illegal Mexican workers in Phoenix last week was timed to disrupt efforts to count Hispanics in the 1980 census.

The U.S. Census Bureau has acknowledged that Hispanics were undercounted in the last census, and therefore lost some of the political representation and federal dollars that are distributed according to population.

This year, millions of dollars are being spent on a promotional campaign to persuade Hispanics -- both legal and illegal residents -- that the census data is confidential. The arrests of aliens at the time of the headcount could cause widespread suspicion that the census was being used by the Immigration and Naturalization Service.

The government is so anxious to assuage such fears that Attorney General Benjamin Civilletti has recorded two 30-second radio and TV spots for use on Spanish-language stations.

Census data, Civiletti pledged this week, "will not be sought by, accepted by or divulged to the Immigration and Naturalization Service or any other arm of the Department of Justice."

David Crosland, acting commissioner of the INS, sent a telegram to all field offices Friday night outlining what he called "special precautions" for the next three months: No INS agents are to enter homes or workplaces without a search warrant, court order, or approval of a U.S. attorney.

Permission is to be granted only in cases involving specific individuals suspected of fraud, drug, smuggling or other crimes, based on ducuments or on the word of sources willing to testify.

Crosland said this action was taken "in order to insure that census operations take place in an atmosphere conducive to complete participation and disclosure of information by all groups."

Immigration officials said it was a coincidence that the Phoenix raid occurred a few days before census forms were sent to 86 million American homes. However, Arizona's Gov. Bruce Babbitt, who sent a telegram to Civiletti urging a moratorium on such sweeps, said it had done "irreparable harm to attempts to get an accurate population count in the Southwest."

After the arrests, the local Spanish-language station stopped broadcasting census commercials. State Sen. Alfredo Gutierrez accused the government of "trying to scare people away from the census." Talk of a boycott spread.

Vilma S. Martinez of the Mexican-American Legal Defense and Education Fund yesterday cited "the overwhelming importance of the census" to Hispanic groups. However, she said, undocumented workers are "fearful of contact with any government agency . . . It's too bad [the INS order] is coming so late in the game."

While the government tries to count illegal residents, the Federation for American Immigration Reform is urging President Carter to announce that illegal aliens "are not expected to respond to the 1980 census and should not do so."

The group, joined by 26 members of Congress, recently lost a Supreme Court bid to stop illegal aliens from being counted for reapportionment of congressioinal, state and local voting districts.