You can perform this task by using the Group Policy Management Console for an AppLocker policy in a Group Policy Object (GPO) or by using the Local Security Policy snap-in for an AppLocker policy on a local computer or in a security template.
Please refer
https://learn.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-control/applocker/create-applocker-default-rules
If the Answer is helpful, please click Accept Answer
and up-vote, so that it can help others in the community looking for help on similar topics.