IMH records are supposed to be medical records, that stays in IMH. No other government agency should be able to access it.
NUS is an educational institution, there shouldn't be a way for them to retrieve your medical records.
NUS medical school does not discriminate against race, gender or medical conditions. There should be no reason why it should affect your medical school application.
Moreover, it is very common to have a mental illness, up to 1 in 5 people will have. For example in a class of 300 medical students, 60 of them would have seen a psychiatrist or psychologist.
So, go ahead and apply, and go ahead and seek treatment.