Was Abiathar the father or the son of Ahimelech?
Abiathar was the son of Ahimelech.
And one of the sons of Ahimelech the son of Ahitub, named Abiathar. 1 Samuel 22:20
Abiathar was the father of Ahimelech.
Ahimelech the son of Abiathar. 2 Samuel 8:17, 1 Chronicles 18:16, 24:6
The Oxford Annotated Bible note for 2 Samuel 8:17: Ahimelech the son of Abiathar should perhaps be reversed (1 Sam.22.20), though is is also possible that Abiathar had a son Ahimelech who acted in place of his aged father (1 Chr.18.16; 24.3,6,31).