The invention relates to a method for determining the content of nitrogen in nitrate and/or nitrite of a water sample and a device thereof. According to the method, the water sample, deionized water and a buffer solution of which the pH value is 5.2-8.6 are mixed to prepare a mixed liquor, then the mixed liquor is heated at the temperature of 50-80 DEG C and then is irradiated under ultraviolet light, or the obtained mixed liquor is directly mixed with a sulfanilamide color-developing agent, and the content of the nitrogen in the nitrate and/or the nitrite of the water sample is detected by an ultraviolet and visible spectrophotometer. The device disclosed by the invention comprises a sample introduction device, a sampling ring, a multi-ported valve, a peristaltic pump, a heating module, an ultraviolet digestion module, a knitting reactor, a flow cell, the ultraviolet and visible spectrophotometer, a deionized water container, a buffer solution container, a color-developing agent container, a first three-way valve, a second three-way valve, a first back pressure regulator, a second back pressure regulator, a waste liquor groove and a computer. The method is nontoxic, and has no pollution on the environment; and the device is high in test sensitivity and good in accuracy.