Joaninne Nanyange, who is studying law, said she was stopped by a police officer and another woman at the entrance to her university before being grilled about her outfit.
When the cop asked her if she could pull her skirt down she burst out laughing, she said.
In a Facebook post shared by hundreds of people, Joaninne said: “This nonsense needs to end.”
Along with her account of what happened at her university in Kampala, Uganda, Joannine also posted pictures of the outfit she was wearing.
The student added: “I work hard, and I manage to pay the millions of shillings required for LDC”s tuition.
“But I can”t access the campus to attend my classes because when “my brothers” look at my knees and legs, they will get erections.”
Joannine believes the bizarre incident highlights the wider issue of women”s rights in Uganda.
Speaking to the BBC”s World Have Your Say she said her skirt wouldn”t be considered short even in the world of the legal profession.
She said: “And secondly, the reason they gave me…it wasn’t about the fact that your profession requires you to have this length of skirt, it was about the fact that if you go with this length you’ll distract the men and boys.
“That is what I found most shocking and more infuriating.”