Humorous or famous dictum as motto for a scientific text - is it appropriate?
In a thesis the appropriateness depends on the style guide of the university in question.  This should be posted somewhere (probably on the university library or graduate school website).  When I wrote my dissertation, such a thing was allowed.  I did not use one, but I knew people who did.

For an article published in a journal, it would depend on their style standards.  You should be able to ask an editor if it is allowed.