From my research, the following process is legit. But please check with a lawyer/US Embassy.

1. Set up a bank account in your host country.

2. Get a B1/B2 visa and then go to the US.

3. Assuming you get selected at YC you will need to setup the a company which is fine.

4. Next you will need to take the YC investment of $15K, but you can't take that into a US account, so instead have them wire it to your account in your host country. After this when you come back for 3 months, you should be okay as long as you withdraw money only from your account. If possible get your visa status changed to a work visa then.