I can't say for certain if this is an authoritative source, but the YouTube video "[TIPS] IELTS Common Mistakes in Writing Numbers: Use Comma or Point ? (Part 3)" suggests this:
Use a comma only when there are more than four digits. In other words:
Per that, your answer should be 1,400,002.
But I'm assuming there are many IELTS-specific style guides that you could refer to which would answer the question definitively.
IELTS aside, the use of commas varies somewhat depending on what style is used, what country you're in, and the specific context of your writing. (Non-English languages can have completely different styles.)
The Chicago Manual of Style (17th. ed), 9.54:
In a style followed in most general contexts in the United States and most other English-speaking parts of the world, for numerals of one thousand or more, commas are used between groups of three digits, counting from the right. Commas are not used for figures to the right of the decimal marker.
Nor are commas used in page numbers, line numbers (e.g., in poetry and plays), addresses, and years (though years of five digits or more do include the comma).
Punctuation conventions can be found on page 1535 of the tenth edition.
Our business office is at 11030 South Langley Avenue.
Human artifacts dating from between 35,000 BP and 5000 BP have been found there.
In scientific writing, commas are often omitted from four-digit numbers.
However, in Chicago, 9.56:
In the International System of Units (SI units), thin, fixed spaces rather than commas are normally used to mark off groups of three digits, both to the left and to the right of the decimal marker. (In electronic publications, a regular nonbreaking space may be used . . .) No space is used for groups of only four digits either to the left or to the right of the decimal marker (except in table columns that also include numbers having five or more digits, where it is needed for alignment). To mark the decimal, either a decimal point or a comma may be used, according to what is customary in a given context or region (the examples that follow show the decimal point).
3 426 869
2501.4865 (or 2 501.486 5)