It sounds like you want to create a solution than can be deployed as an ARM template. I think you are on the right track.
I would start by creating a working solution in the portal before creating the ARM template(s).
Budget alerts with an action group that runs the shutdown logic app or function. I recommend basing the budget alert on a tag that can be assigned to ML compute resources. Logic Apps will be easier if you are unfamiliar with function development.
https://learn.microsoft.com/en-us/azure/cost-management-billing/costs/tutorial-acm-create-budgets
https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-azure-resource-manager-templates-overview
https://techcommunity.microsoft.com/t5/microsoft-sentinel-blog/export-microsoft-sentinel-playbooks-or-azure-logic-apps-with/ba-p/3275898