Police said they discovered the deceased had a stab wound in the chest and he used a laptop cable to hang himself.
Police handling the issue said they want to establish if the student committed suicide or was killed.
The girlfriend told police the deceased was scheduled to graduate on June 28, when the institution holds its 38th graduation ceremony but when he failed to get all his marks he was upset.
It was then that he locked himself in the room and stabbed himself in the chest before hanging himself at 2 am.
Police were called to the scene and moved the body to the mortuary where an autopsy was planned as part of the probe into the incident.
Police have since grilled a number of friends of the deceased as they probe the matter. Cases of suicide have been on the rise in the past months.
Police handled 499 cases in 2019 and 575 in 2020. At least 313 people are reported to have taken their lives between January and July 2021.
Counselors, medics, and psychologists advise that you can always reach out for help when experiencing any mental health issues. Call Kenya Red Cross toll-free hotline, 1199 for support.
Details of how Kevin Kang'ethe murdered his GF revealed in a US court