You might try the steps in
this YT video. This didn't work for me on Big Sur or Monterey, but maybe that was due to a bug that's been fixed in Sonoma. If you try it and it works, please let us know.
I ended up copying my entire iTunes folder to a USB drive and importing it using the Music.app File->Import... menu item. Before doing this, be sure to go to the Music->Preferences Files tab and make sure that both
Keep Music Media folder organized and
Copy files to Music Media folder when adding to library are checked. If you fail to do this, files won't be copied to your Mac and the resulting Music.app library will be pointing to files on your USB drive.
Importing this way will not copy your playlists. You'll need to export those one-at-a-time from iTunes as xml files, and then import those into Music.app. It's a pain if you have very many of them.
You might also find that you lose much, or most, of your album artwork. If you check
Automatically Update Artwork for Imported Songs in the Music.app->Preferences Advanced tab, it will eventually download new artwork from the Music service. This can take a long time (days) and the new artwork might differ from what you had before.
EDIT:
this YT video suggests a way to get playlists imported all-at-once. I have not tried this.