They can include these limitations in a contract which can be enforced like any contract.
I don't think they can, at least if they are making an argument for why the Defense Production Act should not apply to them. Their original argument is that they will not help with anything that is unconstitutional, such as the unlawful spying on American citizens, without a warrant.
FISA Section 702 (50 U.S.C. § 1881a) or CLOUD Act could be used to override any contractual terms that US government agencies may have agreed to. Those clauses would be unenforceable / unexecutable.
More generally it would be overpowered by the Sovereign Acts Doctrine.
The facts aren’t identical to the 2008 Yahoo FISCR case but that case sets the tone for how any clauses like this would just be brushed under the rug.