You can hide the sync button for individual libraries but not using the above method.
See https://learn.microsoft.com/en-us/answers/questions/1165470/how-can-i-hide-the-sharepoint-online-sync-button-w for further details.
Essentially, you can hide this feature via the view setting by 'Formatting view' and adding JSON.
This should be a sufficient solution if users on the site have visitor access.
If users have edit access, you'll have to take additional steps as they will be able to create new views with the Sync button visible.
You can create an additional permission class copying all the features of Edit except at the bottom of the page in the view tab, you can limit users ability to create new views there. You can name this new access type as Edit - No views, or something to that effect to limit confusion down the line.
That's what we did before for users who required Offline Availability but did not have access (or rather we didn't want them to have access to) Sync library.
There's a sample of JSON script in the article attached to enable this feature.
All the best with it.