UEFA, who also fined the club 30,000 euros, said that under new rules introduced in July, a partial stadium closure was now the minimum sanction for any incidents involving racist behaviour.
Legia's next home match is the Champions League playoff second leg against Romanian champions Steaua Bucharest on August 27. The incidents happened in the second qualifying round tie against Welsh side The New Saints, UEFA said.
"The fight against racism is a high priority for UEFA," European soccer's governing body added. "(UEFA) has a policy of zero tolerance towards racism and discrimination on the pitch and in the stands.
"All forms of racist behaviour are considered as serious offences against the disciplinary regulations and are therefore sanctioned accordingly."