Under normal circumstances, it is not recommended to leave the United States during the H1B visa trial, because once you left, the H-1B visa is at risk of being rejected. If your H-1B application is rejected and OPT is no longer valid, you will not be able to return to the US using F-1 status or enter the H-1B visa. In addition, after submitting the H-1B application, if you leave the United States during the trial, the Immigration Department may ask you to activate the H-1B status by way of departure after the H-1B application is approved.
If your F-1 visa and OPT are valid after signing H-1B, then if you want to leave America, you can use the F-1 visa to enter and leave the country. However, since you are in the Change of Status when you apply for H-1B, the departure will be deemed by the Immigration Department to automatically waive the US identity. In other words, even if you return to the US with an F1 visa before October 1, H-1B will not automatically take effect.
If you are unfortunately rejected after being checked, don't panic, you can ask your employer (note that the employer can't change it) to re-submit the H-1B application and be able to prove that the new H-1B application can be corrected before being rejected. The error in the H-1B application.
Most of the rejected H-1B applications at the time of signing were due to lack of some materials, or forgotten signatures, cost mistakes, etc., and some were due to poor performance when they were nominated. So if the new visa can correct the mistakes in the previous application, your H-1B visa application is likely to be approved.