The present invention provides a novel nitrogen-containing heterocyclic compound and salt thereof, and a fungicide for agricultural and horticultural use that contains at least one thereof as an active ingredient, demonstrates reliable effects and can be used safely. The nitrogen-containing heterocyclic compound of the present invention is represented by the following formula (I) (wherein, R1 to R7 each independently represent, for example, a hydrogen atom, halogen atom or C1-20 alkyl group, X represents a halogen atom, nitro group, unsubstituted or substituted amino group, hydroxyl group or organic group, n represents an integer of 0 to 4, and Z represents, for example, an oxygen atom, sulfur atom or group represented by the formula NR10 (wherein, R10 represents, for example, an alkyl group)).