The most effective way for the writer to create dramatic irony and increase tension in the story is:
by revealing the killer’s identity to readers right before the detective unknowingly enters a scene with the killer.
This approach would heighten the suspense and tension as the audience is aware of the danger the detective is in while they remain oblivious, creating a sense of urgency and dread for the reader.