Abstract Purpose - The research aims to test the influence of codes of ethics (competence, accountability, and professionalism) on the quality of audit results and to analyze the role of mediation in audit performance and the impact of the codes (competence, accounting, and professionalism) on the quality of auditing results. The attribution theory component is included in the proposed model. Design/methodology/approach - Data for this research is collected through survey methods, namely questionnaires. Research data and hypotheses are analyzed using a structural equation model (SEM), which is based on PLS. Respondents are 109 internal auditors at the Supreme Prosecutor's Office of the Republic of Indonesia. Findings - The results of this study show that competence, accountability, and professionalism have a positive and significant influence on the quality of the audit outcome. In addition, competency, accountant, and professional influence positively and significantly on the performance of the auditor. The auditor's performance has a positive and significant impact on the quality of the audit outcome. Audit performance as a mediation role in this research is fully mediated, which means that significantly independent variables (competence, accounting, and professional) are able to influence the dependent variable (quality of audit outcomes) without going through the mediation variable (auditor performance).Research limitations/implications – Improve and maintain the Code of Ethics (competence, accountability and professionalism) within the Internal Auditor environment at the Attorney General's Office of the Republic of Indonesia. Keywords: Internal Audit, Competence, Accountability, Professional Behavior, Auditor Performance, and Audit Quality