The answer to the OP is yes/no, "it depends". NJ has rather strict used vehicle sales laws. In general if the used car was purchased from an actual dealer in state, then it must be covered under certain warranties and guarantees depending on the age and mileage. This pamphlet explains what those are:
http://www.nj.gov/oag/ca/brief/used.pdf
The actual coverages are dependent on the age and mileage of the vehicle and they range from 30-90 days and 1,000-3,000 miles and cover the powetrain only. The main exclusions are as follows:
-Car is older then 7 years old.
-Car has more then 100,000 miles on it.
-Car was purchased for less then $3,000.
-Car was previously declared a "total loss".
-Car was sold specifically AS-IS.
A purchaser can also waive their right to the warranty in exchange for a lower price as long as the car has more than 60,000 miles on it. Such a waiver must be in writing and part of the sale documents.
On the specific topic of passing inspection, all cars are considered to be able to pass inspection and must be guaranteed to do so unless the dealer specifically states they offer no such guarantee. The words "AS-IS" on the sticker are sufficient to waive their guarantee on inspection. Many dealers however, still offer this "guarantee" even on their "AS-IS" vehicles, but that isn't a universal.
Now, since the OP bought their car "as-is" there is no warranty in effect through NJ Used Car Lemon Law and we can assume that the inspection guarantee is waived as well. However, since the car failed inspection, it most likely did so for emissions since that is the only thing still tested. A car can fail it's emissions test for many reasons. It can be as simple as the car neeidng a "tune up" or it can be as complicated as a failed sensor, bad injector or damaged catalytic converter.
In cases of emissions the federal government requires that all cars carry an 8 year / 80k mile warranty on emissions components. This covers only the major (and very expensive) parts of the emissions system out to the 8/80k limit (everything emissions related must be covered for 2/24k). Here is a list of some of the components that are covered from the EPA:
http://www.epa.gov/oms/consumer/warr95fs.txt
Basically, OP, you have no recourse against the dealer since the car was sold "as-is". However, if the car is less then 8 years old and has less then 80k miles, you are covered under the federal emissions warranty and so anything major on the emissions test will be covered. Bring the failed test to a NJ licensed emissions repair facility and have them check it out. Anything minor is going to be on you, anything major should still be covered under federal as long as the car isn't over 8 years and 80k miles.
Find an emissions repair facility here:
State of New Jersey - Motor Vehicle Commission