Purpose To quantify potential heterogeneity of treatment effect (HTE), of early sedation with dexmedetomidine (DEX) compared with usual care, and identify patients who have a high probability of lower or higher 90-day mortality according to age, and other identified clusters. Methods Bayesian analysis of 3904 critically ill adult patients expected to receive invasive ventilation > 24 h and enrolled in a multinational randomized controlled trial comparing early DEX with usual care sedation. Results HTE was assessed according to age and clusters (based on 12 baseline characteristics) using a Bayesian hierarchical models. DEX was associated with lower 90-day mortality compared to usual care in patients > 65 years (odds ratio [OR], 0.83 [95% credible interval [CrI] 0.68–1.00], with 97.7% probability of reduced mortality across broad categories of illness severity. Conversely, the probability of increased mortality in patients ≤ 65 years was 98.5% (OR 1.26 [95% CrI 1.02–1.56]. Two clusters were identified: cluster 1 (976 patients) mostly operative, and cluster 2 (2346 patients), predominantly non-operative. There was a greater probability of benefit with DEX in cluster 1 (OR 0.86 [95% CrI 0.65–1.14]) across broad categories of age, with 86.4% probability that DEX is more beneficial in cluster 1 than cluster 2. Conclusion In critically ill mechanically ventilated patients, early sedation with dexmedetomidine exhibited a high probability of reduced 90-day mortality in older patients regardless of operative or non-operative cluster status. Conversely, a high probability of increased 90-day mortality was observed in younger patients of non-operative status. Further studies are needed to confirm these findings. Supplementary Information The online version contains supplementary material available at 10.1007/s00134-021-06356-8.