Hi
You can do this in Microsoft defender Endpoint from going to Settings> Endpoints> Rules > Then select Automation folder Exclusions. See the image below
You can also do this from intune using policies. - Here is a link https://video2.skills-academy.com/en-us/microsoft-365/security/defender-endpoint/configure-exclusions-microsoft-defender-antivirus?view=o365-worldwide#create-a-new-antivirus-policy-with-exclusions-in-intune