Set object local axis based on face orientation
This is not exactly a solution, but a painful workaround. If someone can provides a better answer, I will accept it.

The solution relies on two assumptions:


You can create a Custom Transform Orientation which matched your desired orientation.
You don't mind that object will be moved.


"Solution":


Create a Custom Transform Orientation. For this simple example: select the edge you want to align, press CtrlAltSpace or find it at bottom of the N-Panel.
Rotate to align custom transform to global axis. I followed this post. In short: add empty at the face center, align it to custom transform, parent object to the empty, clear the empty rotation, clear the object's parent keeping transformation, rotate 180°.
Change local axis to match the global ones. Use Apply Transformation (CtrlA)