Transportation Security Administration officers who are in a behavioral detection program designed to spot terrorists at airports have been ordered to undergo special training after officers in Boston were accused of racially profiling passengers.

All officers at Boston Logan International Airport, where the profiling is said to have occurred, and managers of similar programs nationwide must attend a four-hour class on why racial profiling is not acceptable and why it is not an effective way to spot terrorists. The order was announced on Friday, in a written statement, by the Homeland Security Department, which oversees the T.S.A.

It said the class would include “a discussion on how terrorists in the United States do not match any racial or ethnic stereotype.”

Officers stationed at more than 100 airports will have to take an online “refresher course to reinforce that racial/ethnic profiling will not be tolerated,” the department said.