How to fix ghee which partly turned white and smells rancidly?
There is sadly no way to reverse or undo rancidity, and the potent flavors are very unpleasant.  The rancid portion should be discarded.

The photo is unusual in that there is a clear color line, which may or may not correspond to the depth the rancidity reached, or how far into the main product the unpleasant breakdown products permeated.   You might try scraping off all of the obviously bad portion (plus a little extra).  Retain the remainder only if it smells (and tastes) normal.  Fortunately, rancidity is easy to detect by odor and taste.