1. Whether you need to pay social security tax is determined by your tax status. The general rule is: If you have been in the US for more than 5 tax calendar years (the first partial year is counted as ONE year), then you are a resident alien for tax purpose, and you NEED to pay social socurity tax. I know some school does not withhold social socurity tax even if you becomes a resident when in school.
2. Tax treaty. As long as your status is F-1 (including OPT), you can claim tax treaty benefit regardless of your tax status.
You can find this information in the instruction of W-9 form.