Is your spouse living in the US or will they travel with/before you to the US in H1B status?
If yes, then you can use H4 Visa. So whenever you travel to the US, your spouse must be present in the US and holding H1B status in order for you to use the H4 Visa.
Otherwise, if you are traveling on your own, you need B1/B2.