Diesels always run very lean, especially at idle or low power output. And when they run rich the smoke is black. You see that at tractor pulls.
If a clogged air filter was the problem, then the symptoms would have been consistent, not intermittent.
Your issue sounds more like a fuel problem. Some people on this forum have had intermittent problems like this which were caused by a piece of debris in the fuel tank that moved around and at times blocked the output pipe. That sounds like a difficult problem to diagnose and to fix, so hopefully it's something easier.