Ribery, who recently signed a new deal with Bayern, was also strongly linked with Real Madrid.
"My France team-mate Eric Abidal, who played under Pep Guardiola at Barcelona, approached me in 2008-09," Ribery was quoted as saying by Sport Bild.
"Of course, I did consider joining Barcelona at the time. They had the best team in the world back then.
"It was not an easy situation. I had an ongoing contract with Bayern and I have always respected the club, also because of Karl-Heinz Rummenigge and Uli Hoeness, who are very important to me.
"I first spoke to Guardiola after our Champions League exit in 2009. He approached me after the 1-1 in Munich to congratulate me with my performance and told me I'm the best. That meant a lot to me."
Ribery's new contract will keep the 30-year-old at Bayern Munich until the summer of 2017.