It was his first tournament in more than a year.
The 39-year-old Swiss, who returned to action after two knee operations last year, beat Briton Dan Evans in three sets in his comeback match in Doha.
But he lost 3-6 6-1 7-5 to Georgia’s Nikoloz Basilashvili in the next round.
“It’s been great to be back on the @atptour, loved every minute playing in Doha once again,” 20-times Grand Slam winner Federer said on social media.
“I’ve decided it’s best to go back to training and as a result, I’ve decided to withdraw from Dubai next week.”
World number two Rafa Nadal has also pulled out of the Dubai Duty Free event, which runs from Sunday to March 20.
Federer is an eight-times Dubai champion and claimed his 100th tour-level title at the tournament in 2019.
He has already decided not to defend his Miami Open title at the March 22 to April 4 Masters 1000 event.
Federer had targeted a return at last month’s Australian Open.
But he skipped the Grand Slam and said he said he would play in events that would help him regain fitness before Wimbledon.