BERKELEY, Calif. — Days after the University of California, Berkeley, canceled an appearance by the author Ann Coulter, two conservative organizations filed a federal lawsuit on Monday accusing the university of trying to “to restrict conservative speech” on campus.

The legal action came after the university canceled Ms. Coulter’s appearance, scheduled for this week, on the grounds that specific threats by anarchist groups threatened security on campus. The groups that invited Ms. Coulter say she is planning to come anyway.

The lawsuit, filed in Federal District Court in San Francisco, was brought by the Berkeley College Republicans and the Young America’s Foundation, a national organization that promotes conservative causes.

“Berkeley promises its students an environment that promotes free debate and the free exchange of ideas,” the lawsuit said, but the promise was breached “through the repressive actions of university administrators and campus police.”