IRS is correct. You are resident alien if you stay in US more than 183 days as H1B visa. You should file 1040. There is no treaty that allows your federal income tax free for 3 years.