In the film, the “iconic” scene showed Dame Barbara’s bikini flying off in the middle of an exercise class.
An image from the scene was included in the order of service for her funeral, accompanied by her quote: “That picture will follow me to the end.”
The chartreuse cotton towelling bikini, which sold to an American buyer after a bidding war between telephone and online buyers, was part of Kerry Taylor Auction’s Vintage, Antique Textiles & Passion for Fashion sale.
Along with the Carry On films, Dame Barbara was also known for her work in EastEnders.
More on Barbara Windsor
Auctioneer Taylor said: “We have had so much interest in this bikini, from devoted fans of the Carry On films to people who simply love Barbara Windsor.
“During her long career, she was renowned for her down-to-earth nature, great sense of humour and superb acting ability.
“She was a true professional. It seems very apt that a bikini that caused her so much embarrassment during the filming will now go to such a good cause, as Barbara herself sadly suffered from this disease.”
Dame Barbara’s husband Scott Mitchell said: “It’s a touching tribute to Barbara to think any item associated with that famous scene will raise money to help people living with Alzheimer’s.
“I’d say it was fitting… but it flew off… so it wasn’t!”
According to Kerry Taylor Auctions, the Carry On Camping wardrobe department would have commissioned duplicate bikinis for the film, but this is the only example known to have survived after it was rescued from a bin during a stock clearance decades ago.
Remnants of the fishing line used to pull the bikini away from Dame Barbara in the film can still be seen stitched to the front of the top, the auction house said.
Kate Lee, chief executive of Alzheimer’s Society, said: “Dame Barbara Windsor inspired so many when she spoke out about her dementia diagnosis and we are so incredibly grateful to have had her and her husband Scott’s unwavering support – what they achieved for people with dementia has been truly awe-inspiring.
“This bikini is an iconic item from an iconic lady.”