Fluorescent fixture won't stay lit
If the lights actually light then apparently the lamps and wiring are good. I would suspect the ballast.

Is your ballast rated for T5 or T8 lamps?

The 'F' on the lamp is just the wattage rating.

I believe the two lamps are incompatible with the ballasts designed for them respectively. A lot of the T5 ballasts are listed as high output or HO. shop for ballasts and I think you will find they are lists for one or the other but not both.

You need the lamps that match your ballast.

Good luck!