Unfortunately, Terraform does not support unclaiming devices directly. But, you can unclaim devices via Dashboard.
First, you need to remove the devices from the network using the Meraki Dashboard or API.
So you can unclaim the devices from the organization via Dashboard.
I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.
Please, if this post was useful, leave your kudos and mark it as solved.