Alves, 39, had presented an appeal on Jan. 30 for his release from pre-trial detention after being jailed on Jan. 20.
However, the judge denied bail based on the fact that Alves is a potential flight risk due to his financial means and Brazilian nationality.
Brazil does not have extradition agreements with Spain.
Alves is accused of sexually assaulting a woman in a nightclub in Barcelona on Dec. 30, 2022.
The initial investigation began in January but Alves was only arrested after a hearing with the alleged victim in late January.
The judge based her decision on the biological results obtained from the victim, surveillance footage from the nightclub, as well as the contradictory statements given by Alves.
He denies any wrongdoing.
Alves had returned to Spain from Mexico where he was playing for Pumas UNAM, but the club has since terminated his contract with them.
Alves has played for several top European clubs such as Barcelona, Juventus, and Paris Saint-Germain.
He was a key part of Barca’s golden years, playing on the team’s right flank with Lionel Messi between 2008 and 2016.
During this period, Alves won the Champions League three times with the Catalan club. He briefly rejoined Barcelona last season before playing at the World Cup with Brazil in Qatar.
The investigation is ongoing, and no date has been set for a trial.