An inkjet recording apparatus comprising: conveying means (31, 41, 51, 61) for conveying a recording medium along a conveying path; an inkjet head that draws an image by dropping ink on a recording surface of the recording medium conveyed by the conveying means; detection means (300, 300B) that includes a light projecting section for emitting a detection beam parallel to a conveying surface of the conveying path and a light receiving section on which the detection beam is incident; a variable detection height mechanism configured to respectively set a first detection height of the detection beam from the conveying surface in a first state for detecting foreign matter remaining on the conveying path by the detection means (300, 300B) in which the conveying means (31, 41, 51, 61) is driven and does not convey the recording medium and a second state for detecting floating of the recording medium from the conveying surface of the conveying path by the detection means (300, 300B) in which the conveying means (31, 41, 51, 61) is driven and conveys the recording medium; and a control mechanism that detects whether or not the detection beam is received by the light receiving section and stops the conveying means when the detection beam is not received, the inkjet recording apparatus being characterized in that the inkjet recording apparatus performs a control, which maintains a first detection height from the conveying surface and makes the control mechanism effective over the conveying path in the first state, and the inkjet recording apparatus performs a control, which maintains a second detection height from the conveying surface and makes the control mechanism effective only in an area in which the recording medium is present in the conveying path in the second state. conveying means (31, 41, 51, 61) for conveying a recording medium along a conveying path; an inkjet head that draws an image by dropping ink on a recording surface of the recording medium conveyed by the conveying means; detection means (300, 300B) that includes a light projecting section for emitting a detection beam parallel to a conveying surface of the conveying path and a light receiving section on which the detection beam is incident; a variable detection height mechanism configured to respectively set a first detection height of the detection beam from the conveying surface in a first state for detecting foreign matter remaining on the conveying path by the detection means (300, 300B) in which the conveying means (31, 41, 51, 61) is driven and does not convey the recording medium and a second state for detecting floating of the recording medium from the conveying surface of the conveying path by the detection means (300, 300B) in which the conveying means (31, 41, 51, 61) is driven and conveys the recording medium; and a control mechanism that detects whether or not the detection beam is received by the light receiving section and stops the conveying means when the detection beam is not received, the inkjet recording apparatus being characterized in that the inkjet recording apparatus performs a control, which maintains a first detection height from the conveying surface and makes the control mechanism effective over the conveying path in the first state, and the inkjet recording apparatus performs a control, which maintains a second detection height from the conveying surface and makes the control mechanism effective only in an area in which the recording medium is present in the conveying path in the second state.