1. If I had a lot of money, I could buy a car.

2. If I could buy a house, I would be happy.

3. If I were a rich person, I could buy a smart phone.

3-2. If I " was" a rich person, I could buy a smart phone.
--------------------------------
Are they all grammatical? Can we use 'was' as in #3-2? Is it correct in a test?

No.

http://writingexplained.org/was-vs-were-difference

All of the sentences you provided are grammatically correct except for the third one (#3-2). Let's break down the reasons for the correct and incorrect usage:

1. If I had a lot of money, I could buy a car.
- This sentence is grammatically correct because it follows a conditional sentence structure called Type 2. In Type 2 conditionals, we use the past simple tense in the "if" clause and the modal verb "could" in the main clause.

2. If I could buy a house, I would be happy.
- This sentence is also grammatically correct and follows the Type 2 conditional structure. The past simple tense is used in the "if" clause, and the modal verb "would" is used in the main clause.

3. If I were a rich person, I could buy a smartphone.
- This sentence is grammatically correct and follows the Type 2 conditional structure. However, you have used the subjunctive form "were" instead of "was." In formal English, the subjunctive mood is used in hypothetical or unreal situations. Although modern English allows the use of "was" instead of "were" in informal speech and writing, using "were" is still considered more correct and preferred in formal contexts.

3-2. If I "was" a rich person, I could buy a smartphone.
- This sentence is grammatically incorrect because it uses the past simple tense "was" instead of the subjunctive form "were." However, in informal English, some people use "was" instead of "were" in these situations. However, for formal writing or in a test, it is recommended to use the subjunctive form "were" to maintain grammatical accuracy.

In conclusion, while sentences #1, #2, and #3 are correct, sentence #3-2 containing "was" instead of "were" would be considered incorrect in formal English.