A federal judge on Tuesday dismissed a defamation lawsuit filed by the former vice-presidential candidate Sarah Palin against The New York Times, saying Ms. Palin’s complaint failed to show that a mistake in an editorial was made maliciously.

“What we have here is an editorial, written and rewritten rapidly in order to voice an opinion on an immediate event of importance, in which are included a few factual inaccuracies somewhat pertaining to Mrs. Palin that are very rapidly corrected,” Judge Jed S. Rakoff of Federal District Court in Manhattan said in his ruling. “Negligence this may be; but defamation of a public figure it plainly is not.”

In the lawsuit, which was filed in June, Ms. Palin contended that a Times editorial that was published roughly two weeks earlier had linked her to a 2011 mass shooting in Arizona even though the news organization knew the connection was false. The editorial was published the day a gunman opened fire at a baseball field where congressmen were practicing for an annual charity game. Several people were injured, including Representative Steve Scalise of Louisiana.

The editorial suggested a connection between a map of targeted electoral districts circulated by Ms. Palin’s political action committee and the 2011 mass shooting by Jared L. Loughner that severely wounded Representative Gabrielle Giffords. The Times later issued a correction, saying there was no link between political rhetoric and the shooting.