Most likely your alternator.
Alternator versus Engine Performance IssuesIn and of itself, a "bad" alternator will not effect the engine performance.That said, IF the alternator is not properly charging the battery, and the BATTERY capacity gets low enough, then the very low power can result in very low spark production at the spark plugs, which will fail to dependably ignite the fuel, AND THEN result in "rough," or no running.So, a "bad" battery itself does not cause rough running, but can lead to battery depletion which can.
Rough running engine-yes, since timing may be off but that's easy to check. Deiseling is usually fuel delivery or alternator not shutting down, possibly a coil problem.
incomplete combustion of fuel
A faulty gas cap could cause the check engine light to come on but it would not cause a rough idle or engine noises. Start with having your local auto parts store read the codes. The codes will help determine why the check engine light is on.
If an alternator is going bad it can cause a rough idle in a 1993 Subaru Legacy. Cold temperatures in the winter can also cause a rough idle in the Subaru Legacy.
Engine number is underneath the distributor on front housing on the rough casting. If that fails check underneath the alternator on front housing.
if you have a carborator, it may have to be adjusted
It absolutly can. if the tank was not filled up prior to to sitting condensation will form causing water to mix with fuel. even a small amount of moisture can cause the engine to run rough.
Have vehicle scanned to determine the problem
yes it is possible
Pressure test the convertor.