The Spain playmaker signed from Bundesliga club RB Leipzig last summer for a reported 60 million euros, but La Liga rules limiting spending on wages and transfers complicated his registration.
Barcelona, mired in debt, registered Olmo to December 31 with 80 percent of injured defender Andreas Christensen's pay thanks to an exception allowing clubs to replace long-term absentees.
After La Liga refused the club's request to extend his registration to the end of the season, Barcelona took the case to court claiming unfair competition and seeking to register Olmo until June 30, 2025.
A Barcelona commercial court said in a ruling dated Monday that it had rejected the club's requests as none of the criteria had been met.
"The aim of authorising the overspend is so that a long-term injury does not undermine the team's competition, not so that the long-term injury allows the registration of players who exceed the limit with their salary," which Barcelona tried to do, the court ruled.
Olmo cannot be registered for the rest of the season, "once it is understood that the player's contract ends on December 31, 2024 and cannot be extended", the court added.
Spanish media said Olmo's contract, initially set to run until 2030, includes a clause that would release the Euro 2024 champion if he could not be registered.
Barcelona can appeal the ruling and Spanish media reported that the club can resort to alternative means to secure the registration.
These include further legal action, board members providing personal assets to guarantee the registration and selling VIP seat packages for the expanded future Camp Nou to generate extraordinary income, they said.
La Liga said it had applied the requirements equally to all teams and welcomed that no exception was made which could otherwise "seriously alter the equality of conditions" of the competition.
Olmo's potential departure would be a huge blow to the Blaugrana, who have let slip their early lead and dropped to third in a tight title race.
Hansi Flick's side sit three points adrift of leaders Atletico Madrid and two behind Real Madrid having played one game more than both rivals.