I recommend you to use the STM32CubeProgrammer software tool: all-in-one multi-OS software tool for programming STM32 microcontrollers. Following the instruction in the User Manual and System requirements.
In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks