Can I Obtain My H1B Visa Outside The U.S.?

My OPT has been extended to 9/30/18 due to the selection from the lottery for H1B. However, I need to travel to my home country and my F1 visa will be expired on 5/23/18. This means that I cannot re-enter US with my F1 visa. So, can I obtain my H1B visa in my home country?