The late rapper and the singer had dated prior to his death.
In a three-page handwritten note Shakur sent from prison in 1995, when he was 24 and she was then in her 30s, he wrote about their relationship and expressed regret to Madonna.
"I must apologize to you. Because like you said I haven't been the kind of friend I know I am capable of being. Not because I am evil or because you weren't worthy but at the risk of sounding over dramatic, the effects of racism make it difficult for a young black man to properly show affection for an older white woman," Tupac wrote.
Shakur died the following year.
The letter is part of a block of personal items from Madonna being auctioned by Gotta Have Rock and Roll. The company obtained the items from Darlene Lutz, a former friend and consultant to the singer.
In 2017, bidding on the letter had reached $100,000, but Madonna had filed an emergency court order over the auction and won a temporary block on the sale. She told a New York City court her stardom "does not obviate my right to maintain my privacy, including with regard to highly personal items."
The Manhattan Supreme Court later ruled the items were now property of the auction company, which opened the path for their sale.
The auction will open on July 17.