Let Γ denote a distance-regular graph. The maximum size of codewords with minimum distance at least d is denoted by A(Γ, d). Let n denote the folded n-cube H(n, 2). We give an upper bound on A( n, d) based on block-diagonalizing the Terwilliger algebra of n and on semidefinite programming. The technique of this paper is an extension of the approach taken by A. Schrijver [8] on the study of A(H(n, 2), d).Observe that |x 1 △y 1 | = |x 2 △y 2 |, |x 1 △y 2 | = |x 2 △y 1 |, and |x 1 △y 1 | + |x 1 △y 2 | = n. Then it follows that ∂(x, y) = min{|x 1 △y 1 |,|x 1 △y 2 |} and 0 ≤ ∂(x, y) ≤ ⌊ n 2 ⌋, where ⌊a⌋ denotes the maximal integer less than or equal to a. It is well-known that n is a bipartite (an almost-bipartite) distance-regular graph with diameter ⌊ n 2 ⌋ for even n (odd n). The paper is organized as follows. In Section 2, we recall some definitions and facts concerning the distance-regular graph and its Terwilliger algebra. In Section 3, we give a basis of the Terwilliger algebra of n by considering the action of automorphism group of n on X × X × X. In Section 4, we study a block-diagonalization of the Terwilliger algebra via the obtained basis. In Section 5, we estimate an upper bound on A( n , d) by semidefinite programming involving the block-diagonalization of the Terwilliger algebra. Moreover, we offer several concrete upper bounds on A( n , d) for 8 ≤ n ≤ 13.