Gomez's club Monza made the announcement on Friday after being notified by FIFA.
The 35-year-old only joined Monza last month after leaving Sevilla and had made two substitute appearances for his new side.
Gomez has been accused of taking the banned substance Terbutaline while playing for Sevilla last year.
The former Atalanta playmaker intends to appeal the decision from world football's governing body.
A statement from Monza read: “AC Monza announces that it has received today – October 20 2023 – from FIFA, through the FIGC, notification of the first degree sentence of the Spanish Anti-Doping Commission, issued against the footballer Alejandro Dario Gomez.
“The sentence includes a two-year disqualification from sporting activities.
“This was a drug taken to calm a bronchospasm crisis, in October 2022, when the player was a member of Sevilla FC.
“AC Monza reserves the right to evaluate the next procedural steps.”
Gomez played two games in Argentina's run to World Cup glory in Qatar last year.