The upscale retailer Barneys has agreed to pay $525,000 in penalties and institute reforms to prevent future customers from being profiled as thieves based on their race or ethnicity, Attorney General Eric T. Schneiderman announced Monday.

The store, which sells $1,300 waste paper baskets and $34,000 alligator backpacks, has agreed to retain an anti-profiling consultant, establish a record-keeping system to monitor investigations, detentions and false stops conducted by employees and to adopt new loss-prevention detention policies and a new anti-profiling policy.

Employees will receive anti-profiling training. The posh emporium also promised to investigate customer complaints and limit access to its closed-circuit TV areas by law enforcement officers -- and to maintain records of their visits -- according to the attorney general.

The accord is the result of a nine-month investigation conducted by the Schneiderman after two African-American customers alleged they were wrongly accused of credit card fraud while shopping at Barneys flagship store on Madison Ave. in Manhattan.

The probe revealed a “disproportionate number of African-American and Latino customers being detained for alleged shoplifting or credit card fraud.”

Other profiling behaviors ranged from door guards flagging minority customers as meriting surveillance to disproportionate scrutiny of sales made to minority customers in the belief their purchases were not legitimate.

Barney’s is “pleased to have come to an agreement,” New York CEO Mark Lee said in a statement.

“During the entirety of our 90-year history, Barney’s New York has prided itself on providing an unparalleled customer experience," the statement continued. "We are a truly progressive company that has absolutely no tolerance for discrimination of any kind, and believe this agreement will help build on that commitment and further strengthen our organization in the years and decades to come.”