The woman said she had gone to the station overnight on Monday in the state's Hamirpur district to seek her husband's release when she was attacked.
"At 11:30pm when there was no one in the room the sub-inspector took me to his room and raped me inside the police station," the woman told CNN-IBN.
The woman filed a complaint with a senior officer on Wednesday over the attack, which allegedly occurred when she refused to pay a bribe to secure the release of her husband.
"The procedure will be followed, the victim has filed a complaint and the guilty will be arrested soon," Virendra Kumar Shekhar, a police official from Hamirpur, said.
Sub-inspector Balbir Singh said a criminal case had been lodged against four officers from the station.
The case is the latest in a string of horrific rapes and murders in Uttar Pradesh, India's most populous state, where its chief minister Akhilesh Yadav is under growing political pressure over his handling of law and order.
Late last month, two girls, aged 12 and 14, were gang-raped and lynched in their village. They were attacked after going into a field to relieve themselves at night because they did not have a toilet at home.
Their families refused to cut the bodies down from the tree for hours in protest, saying police had failed to take action against the attackers because the girls were from a low caste.
Prime Minister Narendra Modi on Wednesday urged all politicians to work together to protect women, in his first comments on the issue since the hanging of the girls sparked public outrage.
Modi warned politicians against "politicising rape", saying they were "playing with the dignity of women" in his first speech to parliament since sweeping to power at last month's national elections.
India brought in tougher laws last year against sexual offenders after the fatal gang-rape of a student in New Delhi in December 2012, but they have failed to stem the tide of violence against women.
Also on Wednesday, a 45-year-old woman was found hanging from a tree in Uttar Pradesh, with her family saying she had been raped and murdered.
A police officer said they were questioning five men over the incident, which occurred several kilometres from her home in Bahraich district.
"They (her husband and son) have alleged that the woman, before being strung up from the tree, was raped and murdered by these men," district superintendent Happy Guptan told AFP.