If you have a retail license, you should be able to transfer it. More at https://learn.microsoft.com/en-us/answers/questions/1297096/transfer-windows-10-license-to-new-build-windows-1
For details, follow https://support.microsoft.com/en-us/windows/reactivating-windows-after-a-hardware-change-2c0e962a-f04c-145b-6ead-fb3fc72b6665#ID0EBD=Windows_10
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin