Jublee Tamuli had travelled 70km (43 miles) from her home for the exam in Assam's Tezpur town with her father, reports in the local press said.
Her father rushed to a market to buy a pair of trousers, but she said she took the curtain since the test was timed.
She later described it as the "most humiliating experience of my life".
"Is it a crime to wear shorts?" she asked reporters outside the exam centre. "All the girls wear shorts. And if they didn't want us to wear shorts, they should have mentioned it in the exam documents."
The incident took place on Wednesday during the entrance exam for an agricultural university being held at Girijananda Chowdhury Institute of Pharmaceutical Sciences, The Indian Express reported.
"They did not check for COVID protocols, masks or even temperature… but they checked for shorts," the paper quoted her as saying.
Ms Tamuli said the exam documents did not specify any dress code and she was allowed by the security guards to enter the institute, but was stopped from entering the examination hall by the teacher.
She said she requested him to speak to her father, but the teacher was unmoved.
The incident has evoked a sharp response from many who have taken to social media to express their outrage.
Many called the teacher's behaviour "outrageous", "ludicrous" and "height of moral policing".
Photo EastMojo Caption: Biswanath girl, in shorts, made to wrap curtain to sit for exam