Flyback diode choice
Multiple paths exist to determine the turns ratio of a transformer in a flyback converter. One of them is to start from the \$BV_{DSS}\$ of the selected MOSFET and apply a derating factor for a safe operation. The derating factor is important to make sure that in any worst-case situation (open loop, short circuit, over-voltage situation etc.) the drain-source voltage always remains in a safe zone. For instance, serious power supply manufacturers apply a 10-15% derating factor (I've seen up to 20% with Japanese designs) to the selected MOSFET. For a universal mains application (85 - 265 V rms input), people usually select 600- or 650-V MOSFETs. If you choose a derating factor of 15%, for the first one, then you will determine the transformer turns ratio and adjust the various protections (like the \$RCD\$ clamp for instance) so that the voltage across the MOSFET never exceeds 600 x 0.85 = 510 V:

Once you have that number on hand, you can determine the transformer turns ratio as described in my APEC seminar, The Dark Side of the Flyback Converter. You need to select the clamp voltage that you accept and the reflected voltage. When you have these numbers (this is explained in the seminar), then you can have a first value for the turns ratio:

As you can see, the turns ratio affects the MOSFET maximum voltage at turn off but it also impacts the secondary-side diode by imposing a blocking voltage during \$t_{on}\$. Therefore, as any converter design, you need to go through several iterations in which you keep the MOSFET voltage under control and makes sure the rectifier is not oversized. Once choices are made, always exercise the converter to check that voltage limits on the semis are guaranteed to be safe across all the possible scenarios (low and high line, short circuit at the board ends, broken optocoupler etc.)