Use this if you want to block but still allow spam filtering to process messages.
Go to Microsoft 365 Defender
Email & collaboration → Policies & rules
Threat policies → Anti-spam policies
Edit the Default Anti-Spam Policy or create a new one
Under Blocked Senders and Domains, add:
example.com
Save