Check engine light on 98 Ford Ranger

My 98 Ford Ranger, 2.5 litre, won’t pass NY inspection because check engine light and codes. Mechanic has done everything( new computer, wiring)but can’t fix it. It runs fantastic with 205000 miles. Hate to have to get rid of it. Would like to keep it to 300,000. Has anyone had this problem?

Maybe the problem is the mechanic and not the truck.
Go by a local Advance or AutoZone and have the pull the codes for you.
Post the codes they give you back here; and in the order as they appear is there is more than one.

That CEL (check engine light) is just a kid in class waving her hand trying to get you attention because she has the answer. You need to have the codes read. Some places will read them for FREE. Try Autozone or Advanced Auto Parts. Get the exact code not just their translation into English and post it back here. It likely will have a format like P1234.