Hello Varma,
The following will help you to trigger the alert when machine is not available in maintenance configuration and if there is no dynamic group is present.
Please use the query and modify accordingly
resources
| where type == 'microsoft.compute/virtualmachines'
| extend vmId = tolower(id)
| join kind=leftouter (
maintenanceresources
| where type == 'microsoft.maintenance/configurationassignments'
| extend resourceId = tolower(properties.resourceId)
| project resourceId
) on $left.vmId == $right.resourceId
| where resourceId == ""
| project vmId