Hey,
as shown on your screenshot, you can configure it right there. Just select the option "Users can create security groups in Azure portal, API or Powershell" and set it to no. This will not affect M365 Groups because there is another option for it right below.
Regards,
Andy