How do I deter drain flies?
You could try pepper extract. Crush very hot peppers in water, let soak, then filter. Wipe this onto a test area and see if this repels the flies.

Or just use pesticide spray on the walls. Use one of the fairly non-persistent products that contain chlorpyrifos or chlorpyrifos-methyl or permethrin. If the flies are getting in around a loosely fitting door, you might get some control just spraying the edge of the door and the jamb.