The invention relates to (hetero)arylsulfonylamino based peptidomimetics of formula (I), wherein R1, R2, R3, A, B, D, Q, k and n are defined as disclosed, or a pharmaceutically acceptable salt or ester thereof. Compounds of formula (I) possess high affinity and selectivity for the somatostatin receptor subtypes SSTR1 and/or SSTR4 and can be used for the treatment or diagnosis of diseases or conditions wherein an interaction with SSTR1 and/or SSTR4 is indicated to be useful.