To effectively communicate and collaborate with others, we must monitor not only other people’s cognitive states (e.g., what someone thinks or believes), but also their metacognitive states (e.g., how confident they are in their beliefs). Confidence is however rarely communicated explicitly: instead, we often perceive others’ confidence via implicit signals such as speech prosody or movement dynamics. Recent advances in artificial intelligence (AI) have broadened the scope of these metacognitive inferences: artificial agents often perform similarly to humans yet rarely explicitly signal their confidence in their beliefs, raising the question as to how humans attribute confidence to AI. Here we report five pre-registered experiments in which participants observed human and artificial agents make perceptual choices, and reported how confident they thought the observed agent was in each choice. Overall, attributions of confidence were sensitive to observed variables such as task difficulty, accuracy, and response time. Strikingly, participants attributed higher confidence to AI agents compared to other humans, even though their behaviour was identical. An illusion of greater confidence in artificial agents’ decisions generalised across different behavioural profiles (Experiment 2), agent descriptions (Experiment 3), and choice domains (Experiment 4). Attributions of confidence also influenced advice-taking behaviour, as participants were more willing to accept the advice of artificial systems compared to matched humans (Experiment 5). Overall, our results uncover a systematic illusion of confidence in AI decisions, and highlight the importance of metacognition in guiding human-machine interactions.