This problem is of course not limited to Windows 10. I have Windows 11, and the above answers did not work for me. But the powershell command is also a solution.
Get-NetIpInterface
(not case sensitive)
will show the metrics:

In my case, index 44 appears twice, and in one instance, the metric is empty. To set a metric, you can type this command in a PowerShell As Administrator shell:
set-netipinterface -interfacemetric 15 -interfaceindex 44
Note that I set a metric of 15, i.e. lower than the 35 of the wifi, because a lower metric has a higher priority.
Rerun the Get-xxx command to verify the new setting.
Run this command to verify that the system has selected the Ethernet connection over the wifi:
ipconfig
The output will show that wifi is "disconnected", and that the Ethernet adapter has an IP address assigned to it.