The officials say the assailants walked into the school early Wednesday, led the two men into the computer lab, killed them and then fled. Authorities have evacuated the building and security forces have deployed to the neighborhood to try to prevent further violence.
The officials said an initial investigation indicates that one of the suspects is the father of a student who was allegedly sexually harassed by one of the victims.
The officials spoke on a condition of anonymity because they were not authorized to speak to the media.
Revenge attacks are common in the south of Egypt.