Let n≥1 and B≥2. A real-valued function f defined on the n-simplex Δn is approximately convex with respect to ΔB−1 iff f(\sum_{i=1}^B t_ix_i) \le \sum_{i=1}^B t_if(x_i) +1 for all x1,...,xB∈Δn and all (t1,...,tB)∈ΔB−1. We determine explicitly the extremal (i.e. pointwise largest) function of this type which vanishes on the vertices of Δn. We also prove a stability theorem of Hyers-Ulam type which yields as a special case the best constants in the Hyers-Ulam stability theorem for ϵ-convex functions.