You can disable dirsync from the cloud-side, which will also result in converting all users to cloud-only. The steps are covered here: https://learn.microsoft.com/en-us/microsoft-365/enterprise/turn-off-directory-synchronization?view=o365-worldwide
In a nutshell, you need to connect via the MSOnline module and run the following cmdlet:
Set-MsolDirSyncEnabled -EnableDirSync $false