If you change the data argument in ggplot() from ToothGrowth to dat, R will look for outlier in the right environment. Based on the output, you might want to change group_by(dose) to group_by(dose, supp) as well. Cheers!
library(tidyverse)
library(rlang)
library(factoextra)
is_outlier <- function(x) {
x < quantile(x, 0.25) - (1.5 * IQR(x)) | x > quantile(x, 0.75) + (1.5 * IQR(x))
}
data("ToothGrowth")
tooth_growth <- ToothGrowth %>%
tibble::rownames_to_column(var = "outlier") %>%
mutate(dose = factor(dose))
dat <- tooth_growth %>%
group_by(dose) %>%
mutate(outlier1 = if_else(is_outlier(len), len, rlang::na_dbl)) %>%
group_by(dose, supp) %>%
mutate(outlier2 = if_else(is_outlier(len), len, rlang::na_dbl))
pos <- position_dodge(0.75)
ggplot(dat, aes(x = dose, y = len, fill = supp)) +
geom_boxplot() +
stat_summary(fun.y = mean, geom = "point", shape = 10, size = 4, position = pos) +
geom_text(aes(label = outlier1), color = 'red',
na.rm = TRUE,
nudge_y = 0.05) +
geom_text(aes(label = outlier2),
na.rm = TRUE,
position = pos,
vjust = 0) +
theme_classic()

Created on 2019-03-27 by the reprex package (v0.2.1)