Cardoso had been included in Trek-Segafredo's team, spearheaded by two-time champion Contador and John Degenkolb, for the Tour de France that starts on Saturday in Duesseldorf, Germany.
"The Union Cycliste Internationale (UCI) announces that Portuguese rider Andre Cardoso was notified of an Adverse Analytical Finding (AAF) of Erythropoietin in a sample collected in the scope of an out-of-competition control on 18 June 2017," the UCI said in a statement.
Cardoso, 32, who had managed top-20 finishes in the Giro d'Italia and the Vuelta a España was to be one of Contador's domestiques in the mountains of the Tour de France, which runs from 1-23 July. The race was set to be the first Tour start of his career.
“I am fully aware that I will be presumed to be guilty, but it's important to me to say that I am devastated by this news and I wanted to state that I have never taken any illegal substances,” Cardoso said in a Facebook post.
“I’ve seen firsthand through my career the awful effects that performance-enhancing drugs have had on our sport, and I would never want to be a part of that.
“I’ve always tried to be a constructive influence in the peloton and on young, aspiring cyclists. It is my great hope that the B sample will come back as negative and clear me of any wrongdoing.”
Should the B-sample confirm the test taken after the Critérium du Dauphiné, where he finished 19th overall, Cardoso faces a four-year ban and a likely end to his career.
"It is with deep disappointment that we have learned that our rider, Andre Cardoso, has tested positive for a prohibited substance. In accordance with our zero tolerance policy, he has been suspended immediately," Trek-Segafredo said in a statement.
"We hold our riders and staff to the highest ethical standards and will act and communicate accordingly as more details become available."
According to UCI rules, Trek-Segafredo can replace Cardoso in their nine-man squad, and veteran climber Haimar Zubeldia will now be called up for his 16th Tour.